Link to GtS settings when we know we are on GtS

This commit is contained in:
Natsu Kagami 2023-07-17 12:30:17 +02:00
parent 5d804c6899
commit 3c8c896deb
Signed by: nki
GPG key ID: 55A032EB38B49ADB
4 changed files with 21 additions and 1 deletions

View file

@ -59,6 +59,7 @@ const ICONS = {
info: () => import('@iconify-icons/mingcute/information-line'),
shortcut: () => import('@iconify-icons/mingcute/lightning-line'),
user: () => import('@iconify-icons/mingcute/user-4-line'),
'user-setting': () => import('@iconify-icons/mingcute/user-setting-line'),
following: () => import('@iconify-icons/mingcute/walk-line'),
pin: () => import('@iconify-icons/mingcute/pin-line'),
bus: () => import('@iconify-icons/mingcute/bus-2-line'),

View file

@ -13,6 +13,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);
@ -197,6 +198,10 @@ function NavMenu(props) {
<Icon icon="user" size="l" /> <span>Profile</span>
</MenuLink>
)}
{currentAccount && accountsIsDtth(currentAccount) &&
<a href={gtsDtthSettings} target='_blank' title="Takes you to DTTHDon settings"> <MenuItem>
<Icon icon="user-setting" size="l" /> <span>User Settings&hellip;</span>
</MenuItem></a>}
<MenuItem
onClick={() => {
states.showAccounts = true;

View file

@ -8,6 +8,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';
function Login() {
useTitle('Log in');
@ -15,7 +16,7 @@ function Login() {
const cachedInstanceURL = store.local.get('instanceURL');
const [uiState, setUIState] = useState('default');
const [instanceText, setInstanceText] = useState(
cachedInstanceURL?.toLowerCase() || 'gts.dtth.ch',
cachedInstanceURL?.toLowerCase() || gtsDtth,
);
const [instancesList, setInstancesList] = useState([]);

13
src/utils/dtth.js Normal file
View 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';