Skip to content

Commit

Permalink
Merge pull request #349 from benz0301/main
Browse files Browse the repository at this point in the history
Don't show nav popup on hover
  • Loading branch information
SimonStnn authored Nov 8, 2024
2 parents 8a0c73b + 822cb39 commit 4b8597a
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 63 deletions.
18 changes: 8 additions & 10 deletions src/background/background.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import browser from 'webextension-polyfill';
import { abbreviateNumber } from 'js-abbreviation-number';
import storage from '@/managers/storage';
import browser from 'webextension-polyfill';
import { AlarmName, Message, initalConfig } from '@/const';
import log, { type LogLevelNames } from '@/managers/log';
import storage from '@/managers/storage';
import remote from '@/remote';
import { AlarmName, Message, initalConfig } from '@/const';
import {
calculateBalloonSpawnDelay,
random,
getBrowser,
isRunningInBackground,
isInSnooze,
sendMessage,
} from '@/utils';

Expand Down Expand Up @@ -61,12 +62,6 @@ const updateBadgeColors = () => {
// Clear all alarms
await browser.alarms.clearAll();

//! Fix for #145
try {
log.debug('Checking for depricated balloonCount');
await storage.sync.remove('balloonCount' as any);
} catch (e) {}

const remoteAvailable = await remote.isAvailable();
if (!remoteAvailable) {
log.warn('Remote is not available, retrying in 1 minute');
Expand All @@ -82,6 +77,7 @@ const updateBadgeColors = () => {
await storage.sync.set('token', usr.token);
localUser = usr;
}

// Get the user from the remote and save it to the local storage
const user = await remote.getUser(localUser.id);
await storage.sync.set('user', user);
Expand Down Expand Up @@ -135,6 +131,9 @@ const updateBadgeColors = () => {
}
log.debug(' - Last spawn was not too recent');

if (await isInSnooze()) return skipSpawnMessage('In snooze');
log.debug(' - Not in snooze');

// Check if the browser is idle
const state = await browser.idle.queryState(5 * 60);
if (state !== 'active') return skipSpawnMessage('Browser is idle');
Expand Down Expand Up @@ -228,7 +227,6 @@ const updateBadgeColors = () => {
...(await storage.sync.get('user')),
count: newCount.count,
});

const msg: Message = {
action: 'updateCounter',
balloonCount: newCount.count,
Expand Down
1 change: 1 addition & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export type SyncStorageStructure = {
config: Config;
token: string;
user: User;
snooze: number | null;
};
export type SyncStorageKey = keyof SyncStorageStructure;

Expand Down
1 change: 1 addition & 0 deletions src/popup/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export default (props: HeaderProps) => {
<NavigationMenuTrigger
hideCheveron
className="h-11 max-h-11 bg-transparent p-0 hover:bg-transparent focus:bg-transparent"
onPointerMove={(e) => e.preventDefault()}
>
<HeaderIcon icon={List} />
</NavigationMenuTrigger>
Expand Down
16 changes: 8 additions & 8 deletions src/popup/components/Leaderboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { type ClassValue } from 'clsx';
import { Medal, ChevronLeft, ChevronRight } from 'lucide-react';
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
import {
Table,
TableBody,
Expand All @@ -11,17 +13,15 @@ import {
TableHeader,
TableRow,
} from '@/components/ui/table';
import { Skeleton } from '@/components/ui/skeleton';
import remote from '@/remote';
import { RemoteResponse } from '@/const';
import { cn } from '@/utils';
import { Button } from '@/components/ui/button';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip';
import { RemoteResponse } from '@/const';
import remote from '@/remote';
import { cn } from '@/utils';

const limit = 10;
const maxPages = 10;
Expand Down Expand Up @@ -88,7 +88,7 @@ export default () => {
<TooltipTrigger asChild>
<Button
variant={'ghost'}
className="w-10 p-0"
size={'icon'}
disabled={isLoading || page <= 1}
onClick={() => setPage(page - 1)}
>
Expand Down
Loading

0 comments on commit 4b8597a

Please sign in to comment.