• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jcubic / 10xDevs / 18840571689

27 Oct 2025 12:14PM UTC coverage: 23.648% (-1.9%) from 25.594%
18840571689

push

github

jcubic
update workflow

1783 of 8857 branches covered (20.13%)

Branch coverage included in aggregate %.

761 of 1901 relevant lines covered (40.03%)

1814.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/components/notes/TopNavigationBar.tsx
1
'use client';
2

3
import { Flex, Button, Text, Box } from '@chakra-ui/react';
4
import { FiSettings } from 'react-icons/fi';
5
import { useRouter } from 'next/navigation';
6
import { memo, useCallback } from 'react';
7
import { signOutAction } from '@/app/actions/auth';
8

9
interface TopNavigationBarProps {
10
  hasUnsavedChanges: boolean;
11
  onLogout: () => void;
12
}
13

14
const TopNavigationBar = memo(function TopNavigationBar({
×
15
  hasUnsavedChanges,
16
  onLogout
17
}: TopNavigationBarProps) {
18
  const router = useRouter();
×
19

20
  const handleLogout = useCallback(async () => {
×
21
    if (hasUnsavedChanges) {
×
22
      const confirm = window.confirm(
×
23
        'You have unsaved changes. Are you sure you want to logout?'
24
      );
25
      if (!confirm) return;
×
26
    }
27

28
    try {
×
29
      await signOutAction();
×
30
      onLogout();
×
31
    } catch (error) {
32
      console.error('Logout failed:', error);
×
33
    }
34
  }, [hasUnsavedChanges, onLogout]);
35

36
  const handleSettingsClick = useCallback(() => {
×
37
    router.push('/settings');
×
38
  }, [router]);
39

40
  return (
×
41
    <Box as="header" borderBottom="1px solid" borderColor="border" bg="bg" px={4} py={2}>
42
      <Flex justify="space-between" align="center">
43
        <Text fontSize="lg" fontWeight="semibold">
44
          SNApp
45
        </Text>
46

47
        <Flex align="center" gap={4}>
48
          {hasUnsavedChanges && (
×
49
            <Text fontSize="sm" color="orange.500">
50
              Unsaved changes
51
            </Text>
52
          )}
53

54
          <Button
55
            p={3}
56
            size="sm"
57
            variant="ghost"
58
            onClick={handleSettingsClick}
59
            aria-label="Settings"
60
            data-testid="user-menu-button"
61
          >
62
            <FiSettings />
63
          </Button>
64

65
          <Button
66
            p={3}
67
            size="sm"
68
            variant="ghost"
69
            onClick={handleLogout}
70
            data-testid="sign-out-button"
71
          >
72
            Logout
73
          </Button>
74
        </Flex>
75
      </Flex>
76
    </Box>
77
  );
78
});
79

80
export default TopNavigationBar;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc