diff --git a/packages/client-core/i18n/en/admin.json b/packages/client-core/i18n/en/admin.json index c83f8127f7..6bef9154f6 100755 --- a/packages/client-core/i18n/en/admin.json +++ b/packages/client-core/i18n/en/admin.json @@ -329,7 +329,10 @@ "startPath": "PWA Start Path", "shortTitleTooltip": "The displayed title of a PWA-installed copy of this app if 'title' is too long; recommended max 12 characters", "startPathTooltip": "The path that a PWA-installed copy of this app will direct to", - "authSettingsRefreshNotification": "Updating authentication settings requires restarting the API pods. This should be complete within a few minutes. Changes you just made may not be reflected until then." + "authSettingsRefreshNotification": "Updating authentication settings requires restarting the API pods. This should be complete within a few minutes. Changes you just made may not be reflected until then.", + "homepageLinkButtonEnabled": "Show link button on homepage", + "homepageLinkButtonRedirect": "URL of homepage link button", + "homepageLinkButtonText": "Text of homepage link button" }, "avatar": { "source": "Source", diff --git a/packages/client-core/src/admin/components/Setting/Client.tsx b/packages/client-core/src/admin/components/Setting/Client.tsx index 65678fa176..41a28c518e 100644 --- a/packages/client-core/src/admin/components/Setting/Client.tsx +++ b/packages/client-core/src/admin/components/Setting/Client.tsx @@ -8,6 +8,7 @@ import { Box, Button, Grid, IconButton, Typography } from '@mui/material' import Tooltip from '@mui/material/Tooltip' import { useAuthState } from '../../../user/services/AuthService' +import InputSwitch from '../../common/InputSwitch' import InputText from '../../common/InputText' import { ClientSettingService, useClientSettingState } from '../../services/Setting/ClientSettingService' import styles from '../../styles/settings.module.scss' @@ -36,6 +37,13 @@ const Client = () => { const [favicon32px, setFavicon32px] = useState(clientSetting?.favicon32px) const [key8thWall, setKey8thWall] = useState(clientSetting?.key8thWall) const [siteDescription, setSiteDescription] = useState(clientSetting?.siteDescription) + const [homepageLinkButtonEnabled, setHomepageLinkButtonEnabled] = useState( + clientSetting?.homepageLinkButtonEnabled as boolean + ) + const [homepageLinkButtonRedirect, setHomepageLinkButtonRedirect] = useState( + clientSetting?.homepageLinkButtonRedirect + ) + const [homepageLinkButtonText, setHomepageLinkButtonText] = useState(clientSetting?.homepageLinkButtonText) useEffect(() => { if (user?.id?.value != null && clientSettingState?.updateNeeded?.value === true) { @@ -60,6 +68,9 @@ const Client = () => { setFavicon32px(clientSetting?.favicon32px) setSiteDescription(clientSetting?.siteDescription) setKey8thWall(clientSetting?.key8thWall) + setHomepageLinkButtonEnabled(clientSetting?.homepageLinkButtonEnabled) + setHomepageLinkButtonRedirect(clientSetting?.homepageLinkButtonRedirect) + setHomepageLinkButtonText(clientSetting?.homepageLinkButtonText) } }, [clientSettingState?.updateNeeded?.value]) @@ -108,7 +119,10 @@ const Client = () => { appSocialLinks: JSON.stringify(appSocialLinks), themeSettings: JSON.stringify(clientSetting?.themeSettings), themeModes: JSON.stringify(clientSetting?.themeModes), - key8thWall: key8thWall + key8thWall: key8thWall, + homepageLinkButtonEnabled: homepageLinkButtonEnabled, + homepageLinkButtonRedirect: homepageLinkButtonRedirect, + homepageLinkButtonText: homepageLinkButtonText }, id ) @@ -128,6 +142,9 @@ const Client = () => { setFavicon32px(clientSetting?.favicon32px) setSiteDescription(clientSetting?.siteDescription) setKey8thWall(clientSetting?.key8thWall) + setHomepageLinkButtonEnabled(clientSetting?.homepageLinkButtonEnabled) + setHomepageLinkButtonRedirect(clientSetting?.homepageLinkButtonRedirect) + setHomepageLinkButtonText(clientSetting?.homepageLinkButtonText) } return ( @@ -165,6 +182,31 @@ const Client = () => { onChange={(e) => setAppBackground(e.target.value)} /> + setHomepageLinkButtonEnabled(e.target.checked)} + /> + + {homepageLinkButtonEnabled && ( + setHomepageLinkButtonRedirect(e.target.value)} + /> + )} + + {homepageLinkButtonEnabled && ( + setHomepageLinkButtonText(e.target.value)} + /> + )} + {t('admin:components.setting.appSocialLinks')} {appSocialLinks?.length > 0 && diff --git a/packages/client-core/src/admin/components/Setting/ClientTheme/index.tsx b/packages/client-core/src/admin/components/Setting/ClientTheme/index.tsx index 7aa305484e..c37e910820 100644 --- a/packages/client-core/src/admin/components/Setting/ClientTheme/index.tsx +++ b/packages/client-core/src/admin/components/Setting/ClientTheme/index.tsx @@ -86,7 +86,10 @@ const ClientTheme = () => { appSocialLinks: JSON.stringify(clientSetting?.appSocialLinks), themeSettings: JSON.stringify(newThemeSettings), themeModes: JSON.stringify(newThemeModes), - key8thWall: clientSetting?.key8thWall + key8thWall: clientSetting?.key8thWall, + homepageLinkButtonEnabled: clientSetting?.homepageLinkButtonEnabled, + homepageLinkButtonRedirect: clientSetting?.homepageLinkButtonRedirect, + homepageLinkButtonText: clientSetting?.homepageLinkButtonText }, id ) diff --git a/packages/client/src/pages/index.tsx b/packages/client/src/pages/index.tsx index e25fbdc3d9..ca43ac2052 100755 --- a/packages/client/src/pages/index.tsx +++ b/packages/client/src/pages/index.tsx @@ -66,13 +66,15 @@ export const HomePage = (): any => { {clientSetting.appDescription} )} - + {clientSetting.homepageLinkButtonEnabled && ( + + )}