|
1 | 1 | import { Button, ColorTokens, Heading, Image, Input, Label, Paragraph, ScrollView, Sheet, SizeTokens, Switch, Theme, Tooltip, XStack, YStack, ZStack, useDebounceValue, useMedia } from '@jonline/ui';
|
2 | 2 | import { AlertCircle, Cpu, Router, AlertTriangle, ArrowDownUp, AtSign, ChevronDown, ChevronLeft, ChevronRight, Info, Plus, SeparatorHorizontal, Server } from '@tamagui/lucide-icons';
|
3 | 3 | import { DarkModeToggle } from 'app/components/dark_mode_toggle';
|
4 |
| -import { useAppDispatch, useCurrentAccount, useFederatedAccountOrServer, useLocalConfiguration } from 'app/hooks'; |
| 4 | +import { useAppDispatch, useCurrentAccount, useFederatedAccountOrServer, useLocalConfiguration, usePinnedAccountsAndServers } from 'app/hooks'; |
5 | 5 | import { useMediaUrl } from 'app/hooks/use_media_url';
|
6 | 6 | import { FederatedEntity, FederatedGroup, RootState, accountID, clearServerAlerts, selectAllAccounts, selectAllServers, serverID, setBrowsingServers, setHasOpenedAccounts, setSeparateAccountsByServer, setViewingRecommendedServers, upsertServer, useRootSelector, useServerTheme } from 'app/store';
|
7 | 7 | import { themedButtonBackground } from 'app/utils';
|
@@ -55,6 +55,8 @@ export function AccountsSheet({ size = '$5', selectedGroup, primaryEntity }: Acc
|
55 | 55 | }
|
56 | 56 | }, [open]);
|
57 | 57 |
|
| 58 | + |
| 59 | + |
58 | 60 | // useEffect(() => {
|
59 | 61 | // if (!openDebounced) {
|
60 | 62 | // setHasOpened(false);
|
@@ -155,6 +157,16 @@ export function AccountsSheet({ size = '$5', selectedGroup, primaryEntity }: Acc
|
155 | 157 | </Tooltip>, [currentServer, browsingOn]);
|
156 | 158 |
|
157 | 159 | const renderContent = open || openDebounced;
|
| 160 | + |
| 161 | + const pinnedServers = usePinnedAccountsAndServers().map(aos => |
| 162 | + `${aos.server ? serverID(aos.server) : null}-(${aos.account ? accountID(aos.account) : null})`); |
| 163 | + |
| 164 | + useEffect(() => { |
| 165 | + if (open) { |
| 166 | + requestAnimationFrame(() => setOpen(false)); |
| 167 | + } |
| 168 | + }, [pinnedServers]); |
| 169 | + |
158 | 170 | return <>
|
159 | 171 | <Button
|
160 | 172 | my='auto'
|
|
0 commit comments