Skip to content

Commit

Permalink
Updated chartjs and added storybooks for popup components
Browse files Browse the repository at this point in the history
  • Loading branch information
PsychoSanchez committed Nov 5, 2024
1 parent c27b128 commit a3ac17d
Show file tree
Hide file tree
Showing 51 changed files with 1,087 additions and 579 deletions.
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const config: StorybookConfig = {
'@storybook/addon-webpack5-compiler-swc',
'@storybook/addon-essentials',
'@storybook/addon-styling-webpack',
'@storybook/addon-themes'
],
framework: {
name: '@storybook/react-webpack5',
Expand Down
11 changes: 11 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { Preview } from '@storybook/react';

import '!style-loader!css-loader!postcss-loader!../src/tailwind.css';

import { withThemeByClassName } from "@storybook/addon-themes";

const preview: Preview = {
parameters: {
controls: {
Expand All @@ -11,6 +13,15 @@ const preview: Preview = {
},
},
},

decorators: [withThemeByClassName({
themes: {
// nameOfTheme: 'classNameForTheme',
light: '',
dark: 'dark',
},
defaultTheme: 'light',
})]
};

export default preview;
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ export default [
'react/prop-types': 'off',
'react/display-name': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',

'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
Expand Down
115 changes: 81 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@storybook/addon-interactions": "^8.4.0",
"@storybook/addon-onboarding": "^8.4.0",
"@storybook/addon-styling-webpack": "^1.0.1",
"@storybook/addon-themes": "^8.4.1",
"@storybook/addon-webpack5-compiler-swc": "^1.0.5",
"@storybook/blocks": "^8.4.0",
"@storybook/react": "^8.4.0",
Expand Down Expand Up @@ -95,13 +96,13 @@
"webpack-cli": "5.1.4"
},
"dependencies": {
"chart.js": "3.2.1",
"chart.js": "^4.4.6",
"idb": "6.1.2",
"react": "17.0.2",
"react-chartjs-2": "3.0.3",
"react-chartjs-2": "^5.2.0",
"react-dom": "17.0.2",
"react-github-contribution-calendar": "2.2.0",
"react-tooltip": "4.2.21",
"react-tooltip": "5.28.0",
"tailwind-merge": "2.5.4",
"throttle-debounce": "5.0.2"
},
Expand Down
7 changes: 5 additions & 2 deletions src/background/controller/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ActiveTabState, TimelineRecord } from '@shared/db/types';
import { getSettings } from '@shared/preferences';
import { setActiveTabRecord } from '@shared/tables/state';
import { HostName, IsoDate } from '@shared/types';
import { getIsoDate, getMinutesInMs } from '@shared/utils/date';
import { isInvalidUrl } from '@shared/utils/url';

Expand Down Expand Up @@ -96,11 +97,13 @@ async function commitTabActivity(currentTimelineRecord: TimelineRecord | null) {
// previous day's total time as well.
// Dates in the array should be different in this case.
const dates = Array.from(
new Set([currentIsoDate, currentTimelineRecord.date]),
new Set([currentIsoDate, currentTimelineRecord.date as IsoDate]),
);

await Promise.all(
dates.map((date) => updateTotalTime(date, currentTimelineRecord.hostname)),
dates.map((date) =>
updateTotalTime(date, currentTimelineRecord.hostname as HostName),
),
);

await setActiveTabRecord(null);
Expand Down
5 changes: 3 additions & 2 deletions src/background/controller/overall.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { setTotalDailyHostTime } from '@shared/db/sync-storage';
import { getActivityTimeline } from '@shared/tables/activity-timeline';
import { HostName, IsoDate } from '@shared/types';

export async function updateTotalTime(
currentIsoDate: string,
hostname: string,
currentIsoDate: IsoDate,
hostname: HostName,
) {
const timeline = await getActivityTimeline(currentIsoDate);
const timeOnRecord = timeline
Expand Down
5 changes: 0 additions & 5 deletions src/popup/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ body {
filter: invert(1);
}

.calendar svg rect {
cursor: pointer;
rx: 3;
}

i.fi::before {
line-height: inherit;
}
Loading

0 comments on commit a3ac17d

Please sign in to comment.