Skip to content

Commit

Permalink
💄 improve: web menu improve
Browse files Browse the repository at this point in the history
  • Loading branch information
MartialBE committed Oct 16, 2024
1 parent f31a986 commit e84e699
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 14 deletions.
4 changes: 3 additions & 1 deletion web/src/i18n/locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,5 +1061,7 @@
"默认 zh-CN-YunyeNeural": "Default zh-CN-YunyeNeural",
"这里选择预计费选项,用于预估费用,如果你觉得计算图片占用太多资源,可以选择关闭图片计费。但是请注意:有些渠道在stream下是不会返回tokens的,这会导致输入tokens计算错误。": "Select the estimated cost option here for cost estimation. If you think that calculating images consumes too many resources, you can choose to disable image billing. However, please note: some channels do not return tokens under stream, which may result in incorrect token calculations.",
"预计费选项": "Estimated fee options",
"请输入版本号,例如:v3[1]": "Please enter the version number, for example: v3.1"
"请输入版本号,例如:v3[1]": "Please enter the version number, for example: v3.1",
"operation": "Operation",
"paySetting": "Payment settings"
}
4 changes: 3 additions & 1 deletion web/src/i18n/locales/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,5 +1061,7 @@
"默认 zh-CN-YunyeNeural": "デフォルトのzh-CN-YunyeNeural",
"这里选择预计费选项,用于预估费用,如果你觉得计算图片占用太多资源,可以选择关闭图片计费。但是请注意:有些渠道在stream下是不会返回tokens的,这会导致输入tokens计算错误。": "こちらでは料金予測オプションを選択し、費用の見積もりに使用します。画像計算がリソースを多く消費すると感じた場合は、画像計算を無効にすることができます。ただし、注意してください:一部のチャネルはstream下ではトークンを返さないため、入力トークンが誤って計算される可能性があります。",
"预计费选项": "見積オプション",
"Please enter the version number, for example: v3[1]": ""
"Please enter the version number, for example: v3[1]": "",
"operation": "オペレーション",
"paySetting": "支払い設定"
}
2 changes: 2 additions & 0 deletions web/src/i18n/locales/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"payment": "支付",
"setting": "设置",
"task": "异步任务",
"operation": "运营",
"paySetting": "支付设置",
"menu": {
"home": "首页",
"about": "关于",
Expand Down
30 changes: 30 additions & 0 deletions web/src/menu-items/billing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { IconCreditCard, IconBrandGithubCopilot } from '@tabler/icons-react';

const icons = { IconCreditCard, IconBrandGithubCopilot };

const Billing = {
id: 'billing',
title: 'Billing',
type: 'group',
children: [
{
id: 'topup',
title: '充值',
type: 'item',
url: '/panel/topup',
icon: icons.IconCreditCard,
breadcrumbs: false
},
{
id: 'model_price',
title: '可用模型',
type: 'item',
url: '/panel/model_price',
icon: icons.IconBrandGithubCopilot,
breadcrumbs: false,
isAdmin: false
}
]
};

export default Billing;
39 changes: 39 additions & 0 deletions web/src/menu-items/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { IconDashboard, IconChartHistogram, IconBallFootball } from '@tabler/icons-react';

const icons = { IconDashboard, IconChartHistogram, IconBallFootball };

const dashboard = {
id: 'dashboard',
title: 'Dashboard',
type: 'group',
children: [
{
id: 'dashboard',
title: '仪表盘',
type: 'item',
url: '/panel/dashboard',
icon: icons.IconDashboard,
breadcrumbs: false,
isAdmin: false
},
{
id: 'analytics',
title: '分析',
type: 'item',
url: '/panel/analytics',
icon: icons.IconChartHistogram,
breadcrumbs: false,
isAdmin: true
},
{
id: 'playground',
title: 'Playground',
type: 'item',
url: '/panel/playground',
icon: icons.IconBallFootball,
breadcrumbs: false
}
]
};

export default dashboard;
17 changes: 5 additions & 12 deletions web/src/menu-items/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import panel from './panel';

import Setting from './setting';
import Dashboard from './dashboard';
import Billing from './billing';
import usage from './usage';
// ==============================|| MENU ITEMS ||============================== //

const menuItems = {
items: [panel],
urlMap: {}
items: [Dashboard, Setting, Billing, usage]
};

// Initialize urlMap
menuItems.urlMap = menuItems.items.reduce((map, item) => {
item.children.forEach((child) => {
map[child.url] = child;
});
return map;
}, {});

export default menuItems;
138 changes: 138 additions & 0 deletions web/src/menu-items/setting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import {
IconSitemap,
IconBasket,
IconKey,
IconUser,
IconUserScan,
IconReceipt2,
IconSettingsCog,
IconBrandTelegram,
IconCoin,
IconBrandPaypal,
IconCoins
} from '@tabler/icons-react';

const icons = {
IconSitemap,
IconBasket,
IconKey,
IconUser,
IconUserScan,
IconReceipt2,
IconSettingsCog,
IconBrandTelegram,
IconCoin,
IconBrandPaypal,
IconCoins
};

const Setting = {
id: 'setting',
title: 'setting',
type: 'group',
children: [
{
id: 'user',
title: '用户',
type: 'item',
url: '/panel/user',
icon: icons.IconUser,
breadcrumbs: false,
isAdmin: true
},
{
id: 'channel',
title: '渠道',
type: 'item',
url: '/panel/channel',
icon: icons.IconSitemap,
breadcrumbs: false,
isAdmin: true
},
{
id: 'operation',
title: '运营',
type: 'collapse',
icon: icons.IconBasket,
isAdmin: true,
children: [
{
id: 'pricing',
title: '模型价格',
type: 'item',
url: '/panel/pricing',
icon: icons.IconReceipt2,
breadcrumbs: false,
isAdmin: true
},
{
id: 'telegram',
title: 'Telegram Bot',
type: 'item',
url: '/panel/telegram',
icon: icons.IconBrandTelegram,
breadcrumbs: false,
isAdmin: true
}
]
},
{
id: 'paySetting',
title: '支付设置',
type: 'collapse',
icon: icons.IconBrandPaypal,
isAdmin: true,
children: [
{
id: 'redemption',
title: '兑换',
type: 'item',
url: '/panel/redemption',
icon: icons.IconCoin,
breadcrumbs: false,
isAdmin: true
},
{
id: 'payment',
title: '支付',
type: 'item',
url: '/panel/payment',
icon: icons.IconBrandPaypal,
breadcrumbs: false,
isAdmin: true
}
]
},

{
id: 'token',
title: '令牌',
type: 'item',
url: '/panel/token',
icon: icons.IconKey,
breadcrumbs: false
},

{
id: 'profile',
title: '个人设置',
type: 'item',
url: '/panel/profile',
icon: icons.IconUserScan,
breadcrumbs: false,
isAdmin: false
},

{
id: 'setting',
title: '设置',
type: 'item',
url: '/panel/setting',
icon: icons.IconSettingsCog,
breadcrumbs: false,
isAdmin: true
}
]
};

export default Setting;
38 changes: 38 additions & 0 deletions web/src/menu-items/usage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { IconArticle, IconBrush, IconList } from '@tabler/icons-react';

const icons = { IconArticle, IconBrush, IconList };

const usage = {
id: 'usage',
title: 'Usage',
type: 'group',
children: [
{
id: 'log',
title: '日志',
type: 'item',
url: '/panel/log',
icon: icons.IconArticle,
breadcrumbs: false
},

{
id: 'midjourney',
title: 'Midjourney',
type: 'item',
url: '/panel/midjourney',
icon: icons.IconBrush,
breadcrumbs: false
},
{
id: 'task',
title: '异步任务',
type: 'item',
url: '/panel/task',
icon: icons.IconList,
breadcrumbs: false
}
]
};

export default usage;

0 comments on commit e84e699

Please sign in to comment.