Skip to content

Commit

Permalink
Merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepzh committed Aug 19, 2024
2 parents f7fd324 + 394d8a1 commit 018b79e
Show file tree
Hide file tree
Showing 27 changed files with 55 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to Time Tracker will be documented in this file.

It is worth mentioning that the release time of each change refers to the time when the installation package is submitted to the webstore. It is about one week for Edge to moderate packages, while only 1-2 days for Chrome and Firefox.

## [2.4.2] - 2024-08-19

- Increase the difficulty of hard mode
- Fix some bugs

## [2.4.1] - 2024-08-12

- Supported weekly limit
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "timer",
"version": "2.4.1",
"version": "2.4.2",
"description": "Time tracker",
"homepage": "https://www.wfhg.cc",
"scripts": {
Expand All @@ -27,12 +27,12 @@
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@babel/preset-env": "^7.25.3",
"@crowdin/crowdin-api-client": "^1.35.0",
"@types/chrome": "0.0.269",
"@types/chrome": "0.0.270",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/echarts": "^4.9.22",
"@types/generate-json-webpack-plugin": "^0.3.7",
"@types/jest": "^29.5.12",
"@types/node": "^22.1.0",
"@types/node": "^22.4.1",
"@types/psl": "^1.1.3",
"@types/punycode": "^2.1.4",
"@types/webpack": "^5.28.5",
Expand All @@ -41,7 +41,7 @@
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"eslint": "^9.8.0",
"eslint": "^9.9.0",
"filemanager-webpack-plugin": "^8.0.0",
"generate-json-webpack-plugin": "^2.0.0",
"html-webpack-plugin": "^5.6.0",
Expand All @@ -64,16 +64,16 @@
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^10.11.0",
"@vueuse/core": "^11.0.0",
"countup.js": "^2.8.0",
"echarts": "^5.5.1",
"element-plus": "2.7.8",
"element-plus": "2.8.0",
"punycode": "^2.3.1",
"stream-browserify": "^3.0.0",
"vue": "^3.4.36",
"vue": "^3.4.38",
"vue-router": "^4.4.3"
},
"engines": {
"node": ">=20"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import {
ComposeOption,
GridComponentOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import { computed, defineComponent } from "vue"
import { useAnalysisRows, useAnalysisTimeFormat } from "../../../context"
import Wrapper, { BizOption } from "./Wrapper"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { DimensionEntry, ValueFormatter } from "@app/components/Analysis/ut

import { defineComponent, watch } from "vue"
import Wrapper from "./Wrapper"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"

const _default = defineComponent({
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {

import { ValueFormatter } from "@app/components/Analysis/util"
import { getRegularTextColor } from "@util/style"
import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { getLineSeriesPalette, tooltipDot, tooltipFlexLine } from "@app/util/echarts"
import { TopLevelFormatterParams } from "echarts/types/dist/shared"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
ScatterSeriesOption, HeatmapSeriesOption,
} from "echarts"

import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { formatPeriodCommon, getAllDatesBetween, MILL_PER_HOUR, MILL_PER_MINUTE } from "@util/time"
import { groupBy, rotate } from "@util/array"
import { t } from "@app/locale"
Expand Down
4 changes: 3 additions & 1 deletion src/app/components/Dashboard/components/Calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import { useEcharts, useRequest } from "@hooks"

import { useRequest } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import { locale } from "@i18n"
import statService from "@service/stat-service"
import { getWeeksAgo, MILL_PER_HOUR } from "@util/time"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ComposeOption } from "echarts/core"
import type { PieSeriesOption, BarSeriesOption } from "echarts/charts"
import type { TooltipComponentOption, GridComponentOption } from "echarts/components"

import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { getPrimaryTextColor } from "@util/style"
import { generateSiteLabel } from "@util/site"
import { getSeriesPalette, getStepColors } from "@app/util/echarts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { StatQueryParam } from "@service/stat-service"
import statService from "@service/stat-service"
import { MILL_PER_DAY } from "@util/time"
import { defineComponent } from "vue"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import Wrapper, { BizOption, DAY_NUM, TOP_NUM } from "./Wrapper"
import ChartTitle from "../../ChartTitle"
import { t } from "@app/locale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { BarSeriesOption, ComposeOption, GridComponentOption, TooltipCompon

import { t } from "@app/locale"
import { getCompareColor, tooltipDot, tooltipFlexLine, tooltipSpaceLine } from "@app/util/echarts"
import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { averageByDay, MINUTE_PER_PERIOD } from "@util/period"
import { getPrimaryTextColor } from "@util/style"
import { formatPeriodCommon, MILL_PER_MINUTE } from "@util/time"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { StyleValue } from "vue"
import Wrapper, { BizOption } from "./Wrapper"
import { computed, defineComponent } from "vue"
import { usePeriodFilter, usePeriodRange, usePeriodValue } from "../context"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"

const CONTAINER_STYLE: StyleValue = {
width: "100%",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ComposeOption, GridComponentOption, LineSeriesOption, TooltipComponentOption } from "echarts"

import { getLineSeriesPalette } from "@app/util/echarts"
import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { formatXAxisTime, generateGridOption } from "../common"
import { TopLevelFormatterParams } from "echarts/types/dist/shared"
import { formatTime } from "@util/time"
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Habit/components/Period/Stack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { StyleValue } from "vue"
import Wrapper, { BizOption } from "./Wrapper"
import { computed, defineComponent } from "vue"
import { usePeriodValue } from "../context"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import { useHabitFilter } from "../../context"

const CONTAINER_STYLE: StyleValue = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ComposeOption, GridComponentOption, TooltipComponentOption, BarSer

import { formatTime } from "@util/time"
import { getPrimaryTextColor } from "@util/style"
import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { getSeriesPalette } from "@app/util/echarts"
import { formatXAxisTime, generateGridOption } from "../common"
import { periodFormatter } from "@app/util/time"
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Habit/components/Period/Trend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { StyleValue } from "vue"
import Wrapper, { BizOption } from "./Wrapper"
import { computed, defineComponent } from "vue"
import { usePeriodValue } from "../context"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import { useHabitFilter } from "../../context"

const CONTAINER_STYLE: StyleValue = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

import { EchartsWrapper } from "@hooks/useEcharts"
import type {
ComposeOption,
GridComponentOption,
Expand All @@ -8,7 +10,6 @@ import type {
LinearGradientObject,
} from "echarts"

import { EchartsWrapper } from "@hooks"
import { getAllDatesBetween } from "@util/time"
import { groupBy, sum } from "@util/array"
import { t } from "@app/locale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { StyleValue, computed, defineComponent } from "vue"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import TimelineWrapper, { BizOption } from "./Wrapper"
import { useHabitFilter } from "../../context"
import { useRows } from "../context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { StyleValue, computed, defineComponent } from "vue"
import Wrapper, { BizOption } from "./Wrapper"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import { useRows } from "../context"
import { useHabitFilter } from "../../context"

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Habit/components/Site/TopK/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ComposeOption, BarSeriesOption, GridComponentOption, TooltipCompon
import { mergeDate } from "@service/stat-service/merge"
import { t } from "@app/locale"
import { SeriesDataItem, generateTitleOption } from "../common"
import { EchartsWrapper } from "@hooks"
import { EchartsWrapper } from "@hooks/useEcharts"
import { getStepColors } from "@app/util/echarts"
import { TopLevelFormatterParams } from "echarts/types/dist/shared"
import { generateSiteLabel } from "@util/site"
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Habit/components/Site/TopK/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { StyleValue, computed, defineComponent } from "vue"
import Wrapper from "./Wrapper"
import { useEcharts } from "@hooks"
import { useEcharts } from "@hooks/useEcharts"
import { useRows } from "../context"
import { useHabitFilter } from "../../context"

Expand Down
2 changes: 0 additions & 2 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useRequest as useRequest0 } from "./useRequest"
import { useShadow as useShadow0 } from "./useShadow"
import { useEcharts as useEcharts0, EchartsWrapper as EchartsWrapper0 } from "./useEcharts"
import { useProvide as useProvide0, useProvider as useProvider0 } from "./useProvider"
import { useCached as useCached0 } from "./useCached"
import { useWindowVisible as useWindowVisible0 } from "./useWindowVisible"
Expand All @@ -10,7 +9,6 @@ import { useMediaSize as useMediaSize0, type MediaSize as MediaSize0 } from "./u

export const useRequest = useRequest0
export const useShadow = useShadow0
export const useEcharts = useEcharts0, EchartsWrapper = EchartsWrapper0
export const useProvide = useProvide0, useProvider = useProvider0
export const useCached = useCached0
export const useWindowVisible = useWindowVisible0
Expand Down
4 changes: 1 addition & 3 deletions src/i18n/element.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Language } from "element-plus/lib/locale"
import type { App } from "vue"
import ElementPlus from 'element-plus'
import { FEEDBACK_LOCALE, locale, t } from "."
import { locale, t } from "."
import calendarMessages from "./message/common/calendar"

const LOCALES: { [locale in timer.Locale]: () => Promise<{ default: Language }> } = {
Expand All @@ -17,13 +17,11 @@ const LOCALES: { [locale in timer.Locale]: () => Promise<{ default: Language }>
}

let EL_LOCALE: Language = null
let EL_LOCALE_FALLBACK: Language = null

export const initElementLocale = async (app: App) => {
const module = await LOCALES[locale]?.()
EL_LOCALE = module?.default
app.use(ElementPlus, { locale: EL_LOCALE })
EL_LOCALE_FALLBACK = (await LOCALES[FEEDBACK_LOCALE]?.())?.default
}

export const EL_DATE_FORMAT = t(calendarMessages, { key: msg => msg.dateFormat, param: { y: 'YYYY', m: 'MM', d: 'DD' } })
2 changes: 2 additions & 0 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const _default: chrome.runtime.ManifestV3 = {
'content_scripts.css',
'static/images/*',
'bundle/*',
'common/*',
'app/*',
],
matches: ["<all_urls>"],
}],
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"@i18n": [
"src/i18n/index"
],
"@echarts/*": [
"src/echarts/*"
"@hooks/*": [
"src/hooks/*"
],
"@hooks": [
"src/hooks/index"
Expand Down
4 changes: 3 additions & 1 deletion webpack/webpack.analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import manifest from '../src/manifest'
const option = generateOption({
outputPath: path.join(__dirname, '..', 'dist_analyze'),
manifest,
mode: "production"
mode: "production",
})

option.optimization.minimize = true
option.optimization.usedExports = true
option.plugins.push(new BundleAnalyzerPlugin())

export default option
16 changes: 12 additions & 4 deletions webpack/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Object.entries(tsPathAlias).forEach(([alias, sourceArr]) => {
.map(folder => path.resolve(__dirname, '..', folder))
resolveAlias[index] = webpackSourceArr
})
resolveAlias['@hooks'] = path.resolve(__dirname, '..', 'src', 'hooks', 'index')
console.log("Alias of typescript: ")
console.log(resolveAlias)

Expand Down Expand Up @@ -135,37 +134,46 @@ const staticOptions: webpack.Configuration = {
optimization: {
splitChunks: {
cacheGroups: {
//////// libraries start ////////
echarts: {
name: 'echarts',
chunks: excludeChunk,
filename: 'bundle/echarts.js',
test: /[\\/]node_modules[\\/](echarts|zrender)[\\/]/,
},
// @vue & vue-router
vue: {
name: 'vue',
chunks: excludeChunk,
filename: 'bundle/vue.js',
test: /[\\/]node_modules[\\/]@?vue(use)?(-router)?[\\/]/,
},
element: {
name: 'element',
chunks: excludeChunk,
filename: 'bundle/element.js',
test: /[\\/]node_modules[\\/]@?element-plus[\\/]/,
},
lodash: {
name: 'lodash',
chunks: excludeChunk,
filename: 'bundle/lodash.js',
test: /[\\/]node_modules[\\/]lodash[\\/]/,
},
axios: {
name: 'axios',
//////// libraries end ////////
//////// common start ////////
api: {
name: 'api',
chunks: excludeChunk,
test: /[\\/]node_modules[\\/]axios[\\/]/,
filename: 'common/api.js',
test: /[\\/]src[\\/]api[\\/]/,
},
common: {
name: 'common',
chunks: excludeChunk,
test: /[\\/]src[\\/](service|database|util)[\\/]/,
},
//////// common end ////////
}
},
},
Expand Down

0 comments on commit 018b79e

Please sign in to comment.