|
@@ -6,9 +6,6 @@ import {
|
|
|
BuildOutlined,
|
|
BuildOutlined,
|
|
|
CloudSyncOutlined,
|
|
CloudSyncOutlined,
|
|
|
DesktopOutlined,
|
|
DesktopOutlined,
|
|
|
- LinkOutlined,
|
|
|
|
|
- MobileOutlined,
|
|
|
|
|
- NotificationOutlined,
|
|
|
|
|
ThunderboltOutlined,
|
|
ThunderboltOutlined,
|
|
|
} from '@ant-design/icons';
|
|
} from '@ant-design/icons';
|
|
|
import type { AllSetting } from '@/models/setting';
|
|
import type { AllSetting } from '@/models/setting';
|
|
@@ -22,7 +19,6 @@ interface HappSettingsContentProps {
|
|
|
updateSetting: (patch: Partial<AllSetting>) => void;
|
|
updateSetting: (patch: Partial<AllSetting>) => void;
|
|
|
isMobile: boolean;
|
|
isMobile: boolean;
|
|
|
remoteSourceBadge: (val: string) => React.ReactNode;
|
|
remoteSourceBadge: (val: string) => React.ReactNode;
|
|
|
- defaultActiveTab?: 'routing' | 'links';
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export default function HappSettingsContent({
|
|
export default function HappSettingsContent({
|
|
@@ -30,7 +26,6 @@ export default function HappSettingsContent({
|
|
|
updateSetting,
|
|
updateSetting,
|
|
|
isMobile,
|
|
isMobile,
|
|
|
remoteSourceBadge,
|
|
remoteSourceBadge,
|
|
|
- defaultActiveTab = 'routing',
|
|
|
|
|
}: HappSettingsContentProps) {
|
|
}: HappSettingsContentProps) {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
// Generator choices stay local until Apply updates the draft; page Save persists it.
|
|
// Generator choices stay local until Apply updates the draft; page Save persists it.
|
|
@@ -65,17 +60,27 @@ export default function HappSettingsContent({
|
|
|
/>
|
|
/>
|
|
|
</SettingListItem>
|
|
</SettingListItem>
|
|
|
|
|
|
|
|
|
|
+ <SettingListItem
|
|
|
|
|
+ paddings="small"
|
|
|
|
|
+ title={t('pages.settings.happLinkEnable')}
|
|
|
|
|
+ description={t('pages.settings.happLinkEnableDesc')}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Switch
|
|
|
|
|
+ checked={allSetting.happLinkEnable}
|
|
|
|
|
+ onChange={(v) => updateSetting({ happLinkEnable: v })}
|
|
|
|
|
+ />
|
|
|
|
|
+ </SettingListItem>
|
|
|
|
|
+
|
|
|
<Tabs
|
|
<Tabs
|
|
|
type="card"
|
|
type="card"
|
|
|
size="small"
|
|
size="small"
|
|
|
- defaultActiveKey={defaultActiveTab}
|
|
|
|
|
items={[
|
|
items={[
|
|
|
{
|
|
{
|
|
|
key: 'routing',
|
|
key: 'routing',
|
|
|
- label: (
|
|
|
|
|
- <span>
|
|
|
|
|
- <BranchesOutlined /> {!isMobile && t('pages.settings.subHappGroupRouting')}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ label: catTabLabel(
|
|
|
|
|
+ <BranchesOutlined />,
|
|
|
|
|
+ t('pages.settings.subHappGroupRouting'),
|
|
|
|
|
+ isMobile,
|
|
|
),
|
|
),
|
|
|
children: (
|
|
children: (
|
|
|
<>
|
|
<>
|
|
@@ -173,27 +178,11 @@ export default function HappSettingsContent({
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- key: 'links',
|
|
|
|
|
- label: catTabLabel(<LinkOutlined />, t('pages.settings.subHappGroupLinks'), isMobile),
|
|
|
|
|
- children: (
|
|
|
|
|
- <SettingListItem
|
|
|
|
|
- paddings="small"
|
|
|
|
|
- title={t('pages.settings.happLinkEnable')}
|
|
|
|
|
- description={t('pages.settings.happLinkEnableDesc')}
|
|
|
|
|
- >
|
|
|
|
|
- <Switch
|
|
|
|
|
- checked={allSetting.happLinkEnable}
|
|
|
|
|
- onChange={(v) => updateSetting({ happLinkEnable: v })}
|
|
|
|
|
- />
|
|
|
|
|
- </SettingListItem>
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- key: 'banners',
|
|
|
|
|
- label: (
|
|
|
|
|
- <span>
|
|
|
|
|
- <NotificationOutlined /> {!isMobile && t('pages.settings.subHappGroupBanners')}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ key: 'appearance',
|
|
|
|
|
+ label: catTabLabel(
|
|
|
|
|
+ <DesktopOutlined />,
|
|
|
|
|
+ t('pages.settings.subHappGroupThemes'),
|
|
|
|
|
+ isMobile,
|
|
|
),
|
|
),
|
|
|
children: (
|
|
children: (
|
|
|
<>
|
|
<>
|
|
@@ -285,15 +274,59 @@ export default function HappSettingsContent({
|
|
|
onChange={(v) => updateSetting({ subHappNotificationExpire: v })}
|
|
onChange={(v) => updateSetting({ subHappNotificationExpire: v })}
|
|
|
/>
|
|
/>
|
|
|
</SettingListItem>
|
|
</SettingListItem>
|
|
|
|
|
+
|
|
|
|
|
+ <SettingListItem
|
|
|
|
|
+ paddings="small"
|
|
|
|
|
+ title={t('pages.settings.subHappColorProfile')}
|
|
|
|
|
+ description={t('pages.settings.subHappColorProfileDesc')}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Space orientation="vertical" style={{ width: '100%' }}>
|
|
|
|
|
+ <Input
|
|
|
|
|
+ value={allSetting.subHappColorProfile}
|
|
|
|
|
+ placeholder='{"serverRowBackgroundColor":"#21003D67"} or resetcolors'
|
|
|
|
|
+ onChange={(e) => updateSetting({ subHappColorProfile: e.target.value })}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Space wrap size="small">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ onClick={() => updateSetting({ subHappColorProfile: 'resetcolors' })}
|
|
|
|
|
+ >
|
|
|
|
|
+ {t('reset')}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ updateSetting({
|
|
|
|
|
+ subHappColorProfile:
|
|
|
|
|
+ '{"serverRowBackgroundColor":"#21003D67","cardBackgroundColor":"#120023B3"}',
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ Violet
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ updateSetting({
|
|
|
|
|
+ subHappColorProfile:
|
|
|
|
|
+ '{"serverRowBackgroundColor":"#002B3667","cardBackgroundColor":"#001F27B3"}',
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ Turquoise
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </Space>
|
|
|
|
|
+ </Space>
|
|
|
|
|
+ </SettingListItem>
|
|
|
</>
|
|
</>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
key: 'network',
|
|
key: 'network',
|
|
|
- label: (
|
|
|
|
|
- <span>
|
|
|
|
|
- <ThunderboltOutlined /> {!isMobile && t('pages.settings.subHappGroupNetwork')}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ label: catTabLabel(
|
|
|
|
|
+ <ThunderboltOutlined />,
|
|
|
|
|
+ t('pages.settings.subHappGroupNetwork'),
|
|
|
|
|
+ isMobile,
|
|
|
),
|
|
),
|
|
|
children: (
|
|
children: (
|
|
|
<>
|
|
<>
|
|
@@ -422,70 +455,45 @@ export default function HappSettingsContent({
|
|
|
]}
|
|
]}
|
|
|
/>
|
|
/>
|
|
|
</SettingListItem>
|
|
</SettingListItem>
|
|
|
- </>
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- key: 'themes',
|
|
|
|
|
- label: (
|
|
|
|
|
- <span>
|
|
|
|
|
- <DesktopOutlined /> {!isMobile && t('pages.settings.subHappGroupThemes')}
|
|
|
|
|
- </span>
|
|
|
|
|
- ),
|
|
|
|
|
- children: (
|
|
|
|
|
- <>
|
|
|
|
|
|
|
+
|
|
|
<SettingListItem
|
|
<SettingListItem
|
|
|
paddings="small"
|
|
paddings="small"
|
|
|
- title={t('pages.settings.subHappColorProfile')}
|
|
|
|
|
- description={t('pages.settings.subHappColorProfileDesc')}
|
|
|
|
|
|
|
+ title={t('pages.settings.subHappPerAppMode')}
|
|
|
|
|
+ description={t('pages.settings.subHappPerAppModeDesc')}
|
|
|
>
|
|
>
|
|
|
- <Space orientation="vertical" style={{ width: '100%' }}>
|
|
|
|
|
- <Input
|
|
|
|
|
- value={allSetting.subHappColorProfile}
|
|
|
|
|
- placeholder='{"serverRowBackgroundColor":"#21003D67"} or resetcolors'
|
|
|
|
|
- onChange={(e) => updateSetting({ subHappColorProfile: e.target.value })}
|
|
|
|
|
- />
|
|
|
|
|
- <Space wrap size="small">
|
|
|
|
|
- <Button
|
|
|
|
|
- size="small"
|
|
|
|
|
- onClick={() => updateSetting({ subHappColorProfile: 'resetcolors' })}
|
|
|
|
|
- >
|
|
|
|
|
- {t('reset')}
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button
|
|
|
|
|
- size="small"
|
|
|
|
|
- onClick={() =>
|
|
|
|
|
- updateSetting({
|
|
|
|
|
- subHappColorProfile:
|
|
|
|
|
- '{"serverRowBackgroundColor":"#21003D67","cardBackgroundColor":"#120023B3"}',
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- Violet
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button
|
|
|
|
|
- size="small"
|
|
|
|
|
- onClick={() =>
|
|
|
|
|
- updateSetting({
|
|
|
|
|
- subHappColorProfile:
|
|
|
|
|
- '{"serverRowBackgroundColor":"#002B3667","cardBackgroundColor":"#001F27B3"}',
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- Turquoise
|
|
|
|
|
- </Button>
|
|
|
|
|
- </Space>
|
|
|
|
|
- </Space>
|
|
|
|
|
|
|
+ <Select
|
|
|
|
|
+ value={allSetting.subHappPerAppMode || 'off'}
|
|
|
|
|
+ style={{ width: '100%' }}
|
|
|
|
|
+ onChange={(v) => updateSetting({ subHappPerAppMode: v })}
|
|
|
|
|
+ options={[
|
|
|
|
|
+ { value: 'off', label: t('pages.settings.subHappPerAppOff') },
|
|
|
|
|
+ { value: 'on', label: t('pages.settings.subHappPerAppOn') },
|
|
|
|
|
+ { value: 'bypass', label: t('pages.settings.subHappPerAppBypass') },
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
|
|
+ </SettingListItem>
|
|
|
|
|
+
|
|
|
|
|
+ <SettingListItem
|
|
|
|
|
+ paddings="small"
|
|
|
|
|
+ title={t('pages.settings.subHappPerAppList')}
|
|
|
|
|
+ description={t('pages.settings.subHappPerAppListDesc')}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Input.TextArea
|
|
|
|
|
+ value={allSetting.subHappPerAppList}
|
|
|
|
|
+ rows={4}
|
|
|
|
|
+ placeholder="org.telegram.messenger, com.google.android.youtube"
|
|
|
|
|
+ onChange={(e) => updateSetting({ subHappPerAppList: e.target.value })}
|
|
|
|
|
+ />
|
|
|
</SettingListItem>
|
|
</SettingListItem>
|
|
|
</>
|
|
</>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
key: 'failover',
|
|
key: 'failover',
|
|
|
- label: (
|
|
|
|
|
- <span>
|
|
|
|
|
- <CloudSyncOutlined /> {!isMobile && t('pages.settings.subHappGroupFailover')}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ label: catTabLabel(
|
|
|
|
|
+ <CloudSyncOutlined />,
|
|
|
|
|
+ t('pages.settings.subHappGroupFailover'),
|
|
|
|
|
+ isMobile,
|
|
|
),
|
|
),
|
|
|
children: (
|
|
children: (
|
|
|
<>
|
|
<>
|
|
@@ -538,47 +546,6 @@ export default function HappSettingsContent({
|
|
|
</>
|
|
</>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- key: 'android',
|
|
|
|
|
- label: (
|
|
|
|
|
- <span>
|
|
|
|
|
- <MobileOutlined /> {!isMobile && t('pages.settings.subHappGroupAndroid')}
|
|
|
|
|
- </span>
|
|
|
|
|
- ),
|
|
|
|
|
- children: (
|
|
|
|
|
- <>
|
|
|
|
|
- <SettingListItem
|
|
|
|
|
- paddings="small"
|
|
|
|
|
- title={t('pages.settings.subHappPerAppMode')}
|
|
|
|
|
- description={t('pages.settings.subHappPerAppModeDesc')}
|
|
|
|
|
- >
|
|
|
|
|
- <Select
|
|
|
|
|
- value={allSetting.subHappPerAppMode || 'off'}
|
|
|
|
|
- style={{ width: '100%' }}
|
|
|
|
|
- onChange={(v) => updateSetting({ subHappPerAppMode: v })}
|
|
|
|
|
- options={[
|
|
|
|
|
- { value: 'off', label: t('pages.settings.subHappPerAppOff') },
|
|
|
|
|
- { value: 'on', label: t('pages.settings.subHappPerAppOn') },
|
|
|
|
|
- { value: 'bypass', label: t('pages.settings.subHappPerAppBypass') },
|
|
|
|
|
- ]}
|
|
|
|
|
- />
|
|
|
|
|
- </SettingListItem>
|
|
|
|
|
-
|
|
|
|
|
- <SettingListItem
|
|
|
|
|
- paddings="small"
|
|
|
|
|
- title={t('pages.settings.subHappPerAppList')}
|
|
|
|
|
- description={t('pages.settings.subHappPerAppListDesc')}
|
|
|
|
|
- >
|
|
|
|
|
- <Input.TextArea
|
|
|
|
|
- value={allSetting.subHappPerAppList}
|
|
|
|
|
- rows={4}
|
|
|
|
|
- placeholder="org.telegram.messenger, com.google.android.youtube"
|
|
|
|
|
- onChange={(e) => updateSetting({ subHappPerAppList: e.target.value })}
|
|
|
|
|
- />
|
|
|
|
|
- </SettingListItem>
|
|
|
|
|
- </>
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
]}
|
|
]}
|
|
|
/>
|
|
/>
|
|
|
|
|
|