chore: priviege i18n

This commit is contained in:
Joel 2024-10-15 21:31:06 +08:00
parent 57f4dfdb6f
commit 70a5d78cc5
4 changed files with 33 additions and 12 deletions

View File

@ -8,6 +8,7 @@ import Button from '@/app/components/base/button'
import type { Permissions } from '@/app/components/plugins/types'
import { PermissionType } from '@/app/components/plugins/types'
const i18nPrefix = 'plugin.privilege'
type Props = {
payload: Permissions
onHide: () => void
@ -44,22 +45,22 @@ const PluginSettingModal: FC<Props> = ({
>
<div className='flex flex-col items-start w-[420px] rounded-2xl border border-components-panel-border bg-components-panel-bg shadows-shadow-xl'>
<div className='flex pt-6 pb-3 pl-6 pr-14 items-start gap-2 self-stretch'>
<span className='self-stretch text-text-primary title-2xl-semi-bold'>Plugin Preferences</span>
<span className='self-stretch text-text-primary title-2xl-semi-bold'>{t(`${i18nPrefix}.title`)}</span>
</div>
<div className='flex px-6 py-3 flex-col justify-center items-start gap-4 self-stretch'>
{[
{ title: 'Who can install and manage plugins?', key: 'canInstall', value: tempPrivilege.canInstall },
{ title: 'Who can debug plugins?', key: 'canDebugger', value: tempPrivilege.canDebugger },
{ title: t(`${i18nPrefix}.whoCanInstall`), key: 'canInstall', value: tempPrivilege.canInstall },
{ title: t(`${i18nPrefix}.whoCanDebug`), key: 'canDebugger', value: tempPrivilege.canDebugger },
].map(({ title, key, value }) => (
<div key={key} className='flex flex-col items-start gap-1 self-stretch'>
<div className='flex m-h-6 items-center gap-0.5'>
<div className='flex h-6 items-center gap-0.5'>
<span className='text-text-secondary system-sm-semibold'>{title}</span>
</div>
<div className='flex items-start gap-2 justify-between w-full'>
{[PermissionType.everyone, PermissionType.admin, PermissionType.noOne].map(option => (
<OptionCard
key={option}
title={option}
title={t(`${i18nPrefix}.${option}`)}
onSelect={() => handlePrivilegeChange(key)(option)}
selected={value === option}
className="flex-1"
@ -74,14 +75,14 @@ const PluginSettingModal: FC<Props> = ({
className='min-w-[72px]'
onClick={onHide}
>
Cancel
{t('common.operation.cancel')}
</Button>
<Button
className='min-w-[72px]'
variant={'primary'}
onClick={handleSave}
>
Save
{t('common.operation.save')}
</Button>
</div>
</div>

View File

@ -134,12 +134,16 @@ const PluginPage = ({
}
{
canSetPermissions && (
<Button
className='w-full h-full p-2 text-components-button-secondary-text group'
onClick={setShowPluginSettingModal}
<Tooltip
popupContent={t('plugin.privilege.title')}
>
<RiEqualizer2Line className='w-4 h-4' />
</Button>
<Button
className='w-full h-full p-2 text-components-button-secondary-text group'
onClick={setShowPluginSettingModal}
>
<RiEqualizer2Line className='w-4 h-4' />
</Button>
</Tooltip>
)
}
</div>

View File

@ -21,6 +21,14 @@ const translation = {
},
install: '{{num}} installs',
installAction: 'Install',
privilege: {
title: 'Plugin Preferences',
whoCanInstall: 'Who can install and manage plugins?',
whoCanDebug: 'Who can debug plugins?',
everyone: 'Everyone',
admin: 'Admins',
noOne: 'No one',
},
}
export default translation

View File

@ -21,6 +21,14 @@ const translation = {
},
install: '{{num}} 次安装',
installAction: '安装',
privilege: {
title: '插件偏好',
whoCanInstall: '谁可以安装和管理插件?',
whoCanDebug: '谁可以调试插件?',
everyone: '所有人',
admin: '管理员',
noOne: '无人',
},
}
export default translation