Disable "connect" action if no accounts are logged
All checks were successful
Docs / build (push) Successful in 2m18s

This commit is contained in:
Полина 2025-01-19 21:21:41 +03:00
parent 36e9ff14f2
commit 556bb92481
2 changed files with 3 additions and 2 deletions

View file

@ -279,6 +279,7 @@ export function Runner(props: { isResizing: boolean }) {
<DropdownMenuItem
onClick={connectionState() === 'offline' ? handleConnect : handleDisconnect}
class="text-xs"
disabled={currentAccountId() === undefined}
>
<Dynamic
component={connectionState() === 'offline' ? LucidePlug : LucideUnplug}
@ -335,7 +336,7 @@ export function Runner(props: { isResizing: boolean }) {
</DropdownMenu>
</div>
</div>
<div class="h-px shrink-0 bg-border" />
<div class="bg-border h-px shrink-0" />
<Devtools
class={cn('size-full grow-0', props.isResizing && 'pointer-events-none')}
iframeRef={setDevtoolsIframe}

View file

@ -3,7 +3,7 @@ import { computed } from 'nanostores'
import { linkedAtom } from './link.ts'
export const $accounts = linkedAtom<TelegramAccount[]>('accounts')
export const $activeAccountId = linkedAtom<string>('activeAccountId')
export const $activeAccountId = linkedAtom<string | undefined>('activeAccountId')
export const $activeAccount = computed([$accounts, $activeAccountId], (accounts, activeAccountId) => {
if (!activeAccountId) return null