diff --git a/src/components/ICONS.jsx b/src/components/ICONS.jsx index f9192671..b55b858e 100644 --- a/src/components/ICONS.jsx +++ b/src/components/ICONS.jsx @@ -103,4 +103,5 @@ export const ICONS = { 'arrows-right': () => import('@iconify-icons/mingcute/arrows-right-line'), code: () => import('@iconify-icons/mingcute/code-line'), copy: () => import('@iconify-icons/mingcute/copy-2-line'), + 'user-setting': () => import('@iconify-icons/mingcute/user-setting-line'), }; diff --git a/src/components/nav-menu.jsx b/src/components/nav-menu.jsx index aa6aa690..5f90fc9e 100644 --- a/src/components/nav-menu.jsx +++ b/src/components/nav-menu.jsx @@ -19,6 +19,7 @@ import store from '../utils/store'; import Avatar from './avatar'; import Icon from './icon'; import MenuLink from './menu-link'; +import { accountsIsDtth, gtsDtthSettings } from '../utils/dtth'; function NavMenu(props) { const snapStates = useSnapshot(states); @@ -203,6 +204,10 @@ function NavMenu(props) { Profile )} + {currentAccount && accountsIsDtth(currentAccount) && + + User Settings… + } Lists diff --git a/src/pages/login.jsx b/src/pages/login.jsx index 5a593ea1..560bfe99 100644 --- a/src/pages/login.jsx +++ b/src/pages/login.jsx @@ -11,6 +11,7 @@ import instancesListURL from '../data/instances.json?url'; import { getAuthorizationURL, registerApplication } from '../utils/auth'; import store from '../utils/store'; import useTitle from '../utils/useTitle'; +import { gtsDtth } from '../utils/dtth'; const { PHANPY_DEFAULT_INSTANCE: DEFAULT_INSTANCE } = import.meta.env; @@ -23,7 +24,7 @@ function Login() { const instance = searchParams.get('instance'); const submit = searchParams.get('submit'); const [instanceText, setInstanceText] = useState( - instance || cachedInstanceURL?.toLowerCase() || 'gts.dtth.ch', + instance || cachedInstanceURL?.toLowerCase() || gtsDtth, ); const [instancesList, setInstancesList] = useState([]); diff --git a/src/utils/dtth.js b/src/utils/dtth.js new file mode 100644 index 00000000..76e831c6 --- /dev/null +++ b/src/utils/dtth.js @@ -0,0 +1,13 @@ +export function accountsIsDtth(account) { + return ( + account.info && + typeof account.info.url === 'string' && + account.info.url.startsWith(gtsDtth) + ); +} + +/** URL to DTTHDon */ +export const gtsDtth = 'https://gts.dtth.ch'; + +/** URL to DTTHDon settings */ +export const gtsDtthSettings = 'https://gts.dtth.ch/settings';