# All files / src/components/layout AppStatusAlerts.tsx

0% Statements 0/46
0% Branches 0/1
0% Functions 0/1
0% Lines 0/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47

     'use client';

    import { CheckCircle, WarningCircle } from '@phosphor-icons/react'
    import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
    import { getStorageConfig } from '@/lib/storage'

    /**
     * Small stack of status alerts to keep tests and users informed about
     * the current storage mode and backend connectivity.
     */
    export function AppStatusAlerts() {
      const { backend } = getStorageConfig()
      const usingLocal = backend === 'indexeddb'

      return (
        <div className="space-y-2" data-testid="status-alerts">
          <Alert
            data-testid="alert-success"
            className="bg-emerald-500/5 border-emerald-500/20"
          >
            <CheckCircle className="col-start-1 mt-0.5 text-emerald-500" weight="fill" />
            <AlertTitle>Workspace ready</AlertTitle>
            <AlertDescription>
              {usingLocal
                ? 'Running in local-first mode so you can work offline without a backend.'
                : 'Connected to your configured backend. Live sync is enabled.'}
            </AlertDescription>
          </Alert>

          {usingLocal && (
            <Alert
              data-testid="alert-error"
              variant="destructive"
              className="bg-destructive/10 border-destructive/40"
            >
              <WarningCircle className="col-start-1 mt-0.5" weight="fill" />
              <AlertTitle>Cloud backend unavailable</AlertTitle>
              <AlertDescription>
                No Flask backend detected. Saving and loading will stay on this device until a server
                URL is configured.
              </AlertDescription>
            </Alert>
          )}
        </div>
      )
    }