Link to GtS settings when we know we are on GtS
This commit is contained in:
parent
d08796fa32
commit
8abcf97d0b
|
@ -109,4 +109,5 @@ export const ICONS = {
|
|||
'heart-break': () => import('@iconify-icons/mingcute/heart-crack-line'),
|
||||
'user-x': () => import('@iconify-icons/mingcute/user-x-line'),
|
||||
minimize: () => import('@iconify-icons/mingcute/arrows-down-line'),
|
||||
'user-setting': () => import('@iconify-icons/mingcute/user-setting-line'),
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import './nav-menu.css';
|
||||
|
||||
import { ControlledMenu, MenuDivider, MenuItem } from '@szhsin/react-menu';
|
||||
import { ControlledMenu, FocusableItem, MenuDivider, MenuItem } from '@szhsin/react-menu';
|
||||
import { memo } from 'preact/compat';
|
||||
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
|
||||
import { useLongPress } from 'use-long-press';
|
||||
|
@ -18,6 +18,7 @@ import Avatar from './avatar';
|
|||
import Icon from './icon';
|
||||
import MenuLink from './menu-link';
|
||||
import SubMenu2 from './submenu2';
|
||||
import { accountsIsDtth, gtsDtthSettings } from '../utils/dtth';
|
||||
|
||||
function NavMenu(props) {
|
||||
const snapStates = useSnapshot(states);
|
||||
|
@ -209,6 +210,10 @@ function NavMenu(props) {
|
|||
<Icon icon="user" size="l" /> <span>Profile</span>
|
||||
</MenuLink>
|
||||
)}
|
||||
{currentAccount && accountsIsDtth(currentAccount) &&
|
||||
<FocusableItem title="Takes you to DTTHDon settings">
|
||||
<a href={gtsDtthSettings} target='_blank'><Icon icon="user-setting" size="l" /> <span>User Settings…</span></a>
|
||||
</FocusableItem>}
|
||||
{lists?.length > 0 ? (
|
||||
<SubMenu2
|
||||
menuClassName="nav-submenu"
|
||||
|
|
|
@ -12,6 +12,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;
|
||||
|
||||
|
@ -24,7 +25,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([]);
|
||||
|
|
13
src/utils/dtth.js
Normal file
13
src/utils/dtth.js
Normal file
|
@ -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';
|
Loading…
Reference in a new issue