Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

refactor: clean code #96

Merged
merged 9 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion public/check.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/error.svg

This file was deleted.

12 changes: 2 additions & 10 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ async function handleNewTab(tab: chrome.tabs.Tab) {

tabMap[tab.id] = tab;

try {
await processTabAndGroup(tab, types);
} catch (error) {
console.error("Error in handleNewTab:", error);
}
await processTabAndGroup(tab, types);
}

async function handleTabUpdate(
Expand Down Expand Up @@ -249,11 +245,7 @@ async function handleTabUpdate(

tabMap[tab.id] = tab;

try {
await processTabAndGroup(tab, types);
} catch (error) {
console.error("Error in handleTabUpdate:", error);
}
await processTabAndGroup(tab, types);
}

chrome.tabs.onCreated.addListener(handleNewTab);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ColorCircle = ({
"--tw-ring-color": colorValue,
} as React.CSSProperties
}
checked={selected}
defaultChecked={selected}
onClick={onClick}
></input>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const LoadingSpinner = () => (
cy="12"
r="10"
stroke="currentColor"
stroke-width="4"
strokeWidth="4"
></circle>
<path
className="opacity-75"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Switch({
type="checkbox"
checked={isChecked}
className="peer sr-only"
onClick={onChange}
onChange={onChange}
/>
<label htmlFor="switch" className="hidden"></label>
<div className="peer h-6 w-11 rounded-full border bg-slate-200 after:absolute after:left-[2px] after:top-0.5 after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-primary peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:ring-green-300"></div>
Expand Down
5 changes: 5 additions & 0 deletions src/components/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,8 @@ export function toast(messageOrOptions: string | Partial<ToastOptions>) {
}, toastOptions.duration);
return element;
}

toast.success = (message: string) => toast({ type: "success", message });
toast.info = (message: string) => toast({ type: "info", message });
toast.warn = (message: string) => toast({ type: "warn", message });
toast.error = (message: string) => toast({ type: "error", message });
Loading