Skip to content

Commit

Permalink
chore: 🔧 settings changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apotdevin committed Aug 17, 2020
1 parent 46b2361 commit 39c7f7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
38 changes: 1 addition & 37 deletions src/views/settings/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LogOut } from 'react-feather';
import { useRouter } from 'next/router';
import { chartColors } from 'src/styles/Themes';
import { useLogoutMutation } from 'src/graphql/mutations/__generated__/logout.generated';
import { useAccounts, useAccount } from 'src/hooks/UseAccount';
import { useAccount } from 'src/hooks/UseAccount';
import {
CardWithTitle,
SubTitle,
Expand All @@ -12,10 +12,6 @@ import {
} from '../../components/generic/Styled';
import { SettingsLine } from '../../../pages/settings';
import { ColorButton } from '../../components/buttons/colorButton/ColorButton';
import {
MultiButton,
SingleButton,
} from '../../components/buttons/multiButton/MultiButton';
import { appendBasePath } from '../../utils/basePath';
import { useChatDispatch } from '../../context/ChatContext';

Expand All @@ -28,7 +24,6 @@ export const AccountSettings = () => {
refetchQueries: ['GetServerAccounts'],
});

const accounts = useAccounts();
const account = useAccount();

useEffect(() => {
Expand All @@ -42,41 +37,10 @@ export const AccountSettings = () => {
return null;
}

const renderChangeAccount = () => {
if (accounts.length <= 1) {
return null;
}

return (
<SettingsLine>
<Sub4Title>Change Account</Sub4Title>
<MultiButton>
{accounts.map(({ name: accountName, id: accountId }) => {
return (
<SingleButton
key={accountId}
selected={accountId === account.id}
onClick={() => {
if (accountId !== account.id) {
dispatchChat({ type: 'disconnected' });
push(appendBasePath('/'));
}
}}
>
{accountName}
</SingleButton>
);
})}
</MultiButton>
</SettingsLine>
);
};

return (
<CardWithTitle>
<SubTitle>Account</SubTitle>
<Card>
{renderChangeAccount()}
<SettingsLine>
<Sub4Title>Logout</Sub4Title>
<ColorButton
Expand Down
8 changes: 4 additions & 4 deletions src/views/settings/Danger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ export const DangerView = () => {
<SubTitle>Danger Zone</SubTitle>
<OutlineCard>
<SettingsLine>
<Sub4Title>Delete all accounts, chats and settings:</Sub4Title>
<Sub4Title>Delete chats and settings:</Sub4Title>
<ButtonRow>
<ColorButton color={'red'} onClick={handleDeleteAll}>
Delete All
Delete
</ColorButton>
</ButtonRow>
</SettingsLine>
Expand All @@ -84,8 +84,8 @@ export const DangerView = () => {
<AlertCircle size={18} color={fontColors.grey7} />
</FixedWidth>
<CheckboxText>
This does not affect in any way your node, only the ThunderHub
accounts saved in this browser.
This does not affect in any way your node, only the information
saved in this browser.
</CheckboxText>
</StyledContainer>
</OutlineCard>
Expand Down

0 comments on commit 39c7f7a

Please sign in to comment.