mirror of https://github.com/msgbyte/tailchat
feat: add discover plugin basic web page
parent
b42d9fd025
commit
e507aaee9d
@ -1,9 +1,11 @@
|
||||
{
|
||||
"label": "Discover",
|
||||
"label.zh-CN": "发现群组",
|
||||
"name": "com.msgbyte.discover",
|
||||
"url": "{BACKEND}/plugins/com.msgbyte.discover/index.js",
|
||||
"version": "0.0.0",
|
||||
"author": "moonrailgun",
|
||||
"description": "Add Discover panel which can help user found groups",
|
||||
"description.zh-CN": "增加一个发现面板,用于探索公开的群组",
|
||||
"requireRestart": true
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import { useAsync } from '@capital/common';
|
||||
import { request } from '../request';
|
||||
|
||||
export const DiscoverPanel: React.FC = React.memo(() => {
|
||||
const { value: list } = useAsync(async () => {
|
||||
const { data } = await request.get('all');
|
||||
|
||||
return data.list ?? [];
|
||||
}, []);
|
||||
|
||||
return <div>DiscoverPanel: {JSON.stringify(list)}</div>;
|
||||
});
|
||||
DiscoverPanel.displayName = 'DiscoverPanel';
|
@ -1 +1,16 @@
|
||||
import { regCustomPanel, Loadable } from '@capital/common';
|
||||
import { Translate } from './translate';
|
||||
|
||||
console.log('Plugin Discover is loaded');
|
||||
|
||||
const DiscoverPanel = Loadable(() =>
|
||||
import('./DiscoverPanel').then((m) => m.DiscoverPanel)
|
||||
);
|
||||
|
||||
regCustomPanel({
|
||||
position: 'navbar-group',
|
||||
icon: 'mdi:compass',
|
||||
name: 'plugin:com.msgbyte.discover/entry',
|
||||
label: Translate.discover,
|
||||
render: DiscoverPanel,
|
||||
});
|
||||
|
@ -0,0 +1,3 @@
|
||||
import { createPluginRequest } from '@capital/common';
|
||||
|
||||
export const request = createPluginRequest('com.msgbyte.discover');
|
@ -0,0 +1,8 @@
|
||||
import { localTrans } from '@capital/common';
|
||||
|
||||
export const Translate = {
|
||||
discover: localTrans({
|
||||
'zh-CN': '探索',
|
||||
'en-US': 'Discover',
|
||||
}),
|
||||
};
|
Loading…
Reference in New Issue