From c59cd4d2cafc5c89a3e7c97037560e41cb799e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=90=91=E5=A4=9C?= <46275354+fu050409@users.noreply.github.com> Date: Sat, 30 Nov 2024 08:54:07 +0800 Subject: [PATCH 01/30] release: alpha (#61) --- .changes/optimize-ui.md | 13 + .changes/pre.json | 2 +- .../workflows/covector-version-or-publish.yml | 1 + .gitignore | 3 - farm.config.ts | 3 +- index.html | 2 +- package.json | 3 + pnpm-lock.yaml | 58 ++++- postcss.config.js | 6 + input.css => src/assets/tailwind.css | 0 src/components/UniversalToolBar.vue | 46 ++-- src/config.ts | 2 +- src/scripts/api.ts | 1 - src/views/account/[id].vue | 123 +++++---- src/views/contest/create.vue | 244 ++++++++++++++++++ src/views/dashboard.vue | 2 +- src/views/index.vue | 8 +- src/views/login.vue | 1 - src/views/problem/[id].vue | 21 +- src/views/problem/create.vue | 16 +- tailwind.config.js | 2 +- 21 files changed, 447 insertions(+), 110 deletions(-) create mode 100644 .changes/optimize-ui.md create mode 100644 postcss.config.js rename input.css => src/assets/tailwind.css (100%) create mode 100644 src/views/contest/create.vue diff --git a/.changes/optimize-ui.md b/.changes/optimize-ui.md new file mode 100644 index 0000000..6d3b787 --- /dev/null +++ b/.changes/optimize-ui.md @@ -0,0 +1,13 @@ +--- +"algohub": patch:perf +--- + +Optimize UI for better performance + +- Use `postcss` instead of use `tailwindcss` directly. +- Optimize color design in light mode. +- Add `loading` state for pages. +- Wrap problems list with PrimeVue `Panel` component. +- Fix bread crumps padding if no links. +- Remove `mode` and add `owner` when creating a problem. +- Prepare for `alpha` release. diff --git a/.changes/pre.json b/.changes/pre.json index 2c90dce..cc62a40 100644 --- a/.changes/pre.json +++ b/.changes/pre.json @@ -1,5 +1,5 @@ { - "tag": "nightly", + "tag": "alpha", "changes": [ ".changes/add-icon.md", ".changes/breadcrumb.md", diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index 9ec68b6..a6e8c77 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - alpha permissions: # required for npm provenance diff --git a/.gitignore b/.gitignore index 9259d26..1aa9ee7 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,5 @@ dist-ssr # unplugin-vue-components components.d.ts -# Tailwind CSS -tailwind.css - # Autogenerated files .aur_ssh_key diff --git a/farm.config.ts b/farm.config.ts index a8c8715..9383f09 100644 --- a/farm.config.ts +++ b/farm.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from "@farmfe/core"; import vue from "@vitejs/plugin-vue"; import worker from "@farmfe/plugin-worker"; +import postcss from "@farmfe/js-plugin-postcss"; import Components from "unplugin-vue-components/vite"; import { PrimeVueResolver } from "@primevue/auto-import-resolver"; import path from "path"; @@ -8,7 +9,7 @@ import path from "path"; const host = process.env.TAURI_DEV_HOST; export default defineConfig({ - plugins: [worker()], + plugins: [worker(), postcss()], vitePlugins: [ vue(), Components({ diff --git a/index.html b/index.html index 2d79ea2..4b4234d 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ AlgoHub - +
diff --git a/package.json b/package.json index d4c8c05..f237d15 100644 --- a/package.json +++ b/package.json @@ -16,17 +16,20 @@ "publish:aur": "node scripts/release-aur.mjs" }, "dependencies": { + "@farmfe/js-plugin-postcss": "^1.9.0", "@farmfe/plugin-worker": "^0.0.6", "@monaco-editor/loader": "^1.4.0", "@primevue/forms": "^4.2.2", "@primevue/themes": "^4.2.2", "@tauri-apps/api": "^2.1.1", "@tauri-apps/plugin-shell": "^2.0.1", + "autoprefixer": "^10.4.20", "axios": "^1.7.7", "md-editor-v3": "^5.0.2", "monaco-editor": "^0.52.0", "pinia": "^2.2.6", "pinia-plugin-persistedstate": "^4.1.3", + "postcss": "^8.4.49", "primeicons": "^7.0.0", "primevue": "^4.2.2", "vue": "^3.5.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4f82579..abfd6fd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@farmfe/js-plugin-postcss': + specifier: ^1.9.0 + version: 1.9.0(@farmfe/core@1.4.1)(postcss@8.4.49) '@farmfe/plugin-worker': specifier: ^0.0.6 version: 0.0.6 @@ -26,6 +29,9 @@ importers: '@tauri-apps/plugin-shell': specifier: ^2.0.1 version: 2.0.1 + autoprefixer: + specifier: ^10.4.20 + version: 10.4.20(postcss@8.4.49) axios: specifier: ^1.7.7 version: 1.7.7 @@ -41,6 +47,9 @@ importers: pinia-plugin-persistedstate: specifier: ^4.1.3 version: 4.1.3(pinia@2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.27.3) + postcss: + specifier: ^8.4.49 + version: 8.4.49 primeicons: specifier: ^7.0.0 version: 7.0.0 @@ -601,6 +610,12 @@ packages: resolution: {integrity: sha512-5DHsqwrl8i0lax+BGSosrPyeaGDnYIqfWRGp49QB1+dt0NM1gGs03w/elsVHiIVhzPjHBFxjLMym9xXPoz2Row==} engines: {node: '>=16.15.1'} + '@farmfe/js-plugin-postcss@1.9.0': + resolution: {integrity: sha512-d9cbcAa/FIoiAovypO8zwwDjhu7lb7tHR0GodS5eO1FD0AIE5bVA+thNml0dkrmjOcMAxtPxhegeLInpRs99oA==} + peerDependencies: + '@farmfe/core': ^1.4.0 + postcss: '>=8.0.0' + '@farmfe/plugin-worker@0.0.6': resolution: {integrity: sha512-eCZcloccm0KYZ0wMvJr/HY/AxL7o1kq/X55Z0YRJKW/PxmXiDTD+/q2VBDL6ZARWpbeEbseJRqnW5dea0VuqvA==} @@ -1209,6 +1224,13 @@ packages: resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} engines: {node: '>=8.0.0'} + autoprefixer@10.4.20: + resolution: {integrity: sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==} + engines: {node: ^10 || ^12 || >=14} + hasBin: true + peerDependencies: + postcss: ^8.1.0 + axios@1.7.7: resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} @@ -1833,6 +1855,9 @@ packages: resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} engines: {node: '>=0.4.x'} + fraction.js@4.3.7: + resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} + fresh@0.5.2: resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} @@ -2437,6 +2462,10 @@ packages: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} + normalize-range@0.1.2: + resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} + engines: {node: '>=0.10.0'} + npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -3847,13 +3876,14 @@ snapshots: style-mod: 4.1.2 w3c-keyname: 2.2.8 - '@covector/apply@0.10.0': + '@covector/apply@0.10.0(mocha@10.8.2)': dependencies: '@covector/files': 0.8.0 effection: 2.0.8(mocha@10.8.2) semver: 7.6.3 transitivePeerDependencies: - encoding + - mocha '@covector/assemble@0.12.0': dependencies: @@ -3870,7 +3900,7 @@ snapshots: - encoding - supports-color - '@covector/changelog@0.12.0(mocha@10.8.2)': + '@covector/changelog@0.12.0': dependencies: '@covector/files': 0.8.0 effection: 2.0.8(mocha@10.8.2) @@ -3880,7 +3910,6 @@ snapshots: unified: 9.2.2 transitivePeerDependencies: - encoding - - mocha - supports-color '@covector/command@0.8.0': @@ -4103,6 +4132,11 @@ snapshots: - supports-color - utf-8-validate + '@farmfe/js-plugin-postcss@1.9.0(@farmfe/core@1.4.1)(postcss@8.4.49)': + dependencies: + '@farmfe/core': 1.4.1 + postcss: 8.4.49 + '@farmfe/plugin-worker@0.0.6': optionalDependencies: farmfe-plugin-worker-darwin-arm64: 0.0.6 @@ -4744,6 +4778,16 @@ snapshots: atomic-sleep@1.0.0: {} + autoprefixer@10.4.20(postcss@8.4.49): + dependencies: + browserslist: 4.24.2 + caniuse-lite: 1.0.30001680 + fraction.js: 4.3.7 + normalize-range: 0.1.2 + picocolors: 1.1.1 + postcss: 8.4.49 + postcss-value-parser: 4.2.0 + axios@1.7.7: dependencies: follow-redirects: 1.15.9(debug@4.3.7) @@ -4969,9 +5013,9 @@ snapshots: covector@0.12.3(mocha@10.8.2): dependencies: '@clack/prompts': 0.7.0 - '@covector/apply': 0.10.0 + '@covector/apply': 0.10.0(mocha@10.8.2) '@covector/assemble': 0.12.0 - '@covector/changelog': 0.12.0(mocha@10.8.2) + '@covector/changelog': 0.12.0 '@covector/command': 0.8.0 '@covector/files': 0.8.0 effection: 2.0.8(mocha@10.8.2) @@ -5358,6 +5402,8 @@ snapshots: format@0.2.2: {} + fraction.js@4.3.7: {} + fresh@0.5.2: {} fs-extra@11.2.0: @@ -5990,6 +6036,8 @@ snapshots: normalize-path@3.0.0: {} + normalize-range@0.1.2: {} + npm-run-path@4.0.1: dependencies: path-key: 3.1.1 diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/input.css b/src/assets/tailwind.css similarity index 100% rename from input.css rename to src/assets/tailwind.css diff --git a/src/components/UniversalToolBar.vue b/src/components/UniversalToolBar.vue index 1b2181b..8877735 100644 --- a/src/components/UniversalToolBar.vue +++ b/src/components/UniversalToolBar.vue @@ -4,14 +4,21 @@ import { useToast } from 'primevue'; import { ref } from 'vue'; import { useRouter } from 'vue-router'; -const props = defineProps<{ - path?: { - icon: string, - label: string, - link: string, - command: () => void - }[] -}>() +const { path, separateBottom } = defineProps({ + path: { + type: Object as () => { + icon: string, + label: string, + link: string, + command: () => void + }[], + default: [] + }, + separateBottom: { + type: Boolean, + default: undefined + } +}) const router = useRouter(); const toast = useToast(); @@ -73,6 +80,13 @@ const createMenuItems = ref([ const toggleCreateMenu = (event: any) => { menu.value.toggle(event); }; + +const toString = (value: any) => { + if (typeof value === 'function') { + return value.toString(); + } + return value; +} -
+
- + - +
-
- - Coming soon... +
+
+ + + + + + +
+ No contests found. +
+
+
+ +
diff --git a/src/views/index.vue b/src/views/index.vue index b7d2a58..3d205cb 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,20 +1,18 @@ \ No newline at end of file From e986572b22f1804a983e5957663232e33d66d07d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 21:02:00 +0800 Subject: [PATCH 17/30] release: bump version (#98) chore: publish new versions Co-authored-by: fu050409 <46275354+fu050409@users.noreply.github.com> --- .changes/pre.json | 1 + src-tauri/CHANGELOG.md | 6 ++++++ src-tauri/Cargo.toml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.changes/pre.json b/.changes/pre.json index 48cfdf9..7235ccf 100644 --- a/.changes/pre.json +++ b/.changes/pre.json @@ -10,6 +10,7 @@ ".changes/create-panel.md", ".changes/create-problem.md", ".changes/fetch-version.md", + ".changes/fix-acc.md", ".changes/fix-aur.md", ".changes/fix-dark-mode.md", ".changes/fix-layout.md", diff --git a/src-tauri/CHANGELOG.md b/src-tauri/CHANGELOG.md index 7e27662..bc99a26 100644 --- a/src-tauri/CHANGELOG.md +++ b/src-tauri/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[0.1.1-beta.1] + +### Bug Fixes + +- [`a8ceba7`](https://github.com/swpu-acm/algohub.git/commit/a8ceba7f1e3c20e25e08556bc8f2d4501d06fb86) ([#97](https://github.com/swpu-acm/algohub.git/pull/97) by [@fu050409](https://github.com/swpu-acm/algohub.git/../../fu050409)) Fixed accuracy calculation in the contest. + ## \[0.1.1-beta.0] ### New Features diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 38d27ba..ce289cb 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "algohub" -version = "0.1.1-beta.0" +version = "0.1.1-beta.1" description = "ACM Algorithm Hub" repository = "https://github.com/swpu-acm/algohub" readme = "../README.md" From 802cc86be8d766b315614b214d7822c967921645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD?= Date: Fri, 13 Dec 2024 19:35:47 +0800 Subject: [PATCH 18/30] feat(org): inrt ui --- src/views/contest/create.vue | 8 +-- src/views/org/create.vue | 102 +++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 src/views/org/create.vue diff --git a/src/views/contest/create.vue b/src/views/contest/create.vue index e403176..bef8f8d 100644 --- a/src/views/contest/create.vue +++ b/src/views/contest/create.vue @@ -12,10 +12,10 @@ const router = useRouter(); const toast = useToast(); const accountStore = useAccountStore(); -if (!accountStore.isLoggedIn) { - toast.add({ severity: 'error', summary: 'Error', detail: 'Please login first', life: 3000 }); - router.push('/login'); -} +// if (!accountStore.isLoggedIn) { +// toast.add({ severity: 'error', summary: 'Error', detail: 'Please login first', life: 3000 }); +// router.push('/login'); +// } const name = ref(''); const description = ref(''); diff --git a/src/views/org/create.vue b/src/views/org/create.vue new file mode 100644 index 0000000..5b8ec58 --- /dev/null +++ b/src/views/org/create.vue @@ -0,0 +1,102 @@ + + + + + From 965d46966182df69e01e570640ec657251c1d32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD?= Date: Fri, 13 Dec 2024 20:52:21 +0800 Subject: [PATCH 19/30] feat(org): inrt ui --- src/views/contest/create.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/contest/create.vue b/src/views/contest/create.vue index bef8f8d..e403176 100644 --- a/src/views/contest/create.vue +++ b/src/views/contest/create.vue @@ -12,10 +12,10 @@ const router = useRouter(); const toast = useToast(); const accountStore = useAccountStore(); -// if (!accountStore.isLoggedIn) { -// toast.add({ severity: 'error', summary: 'Error', detail: 'Please login first', life: 3000 }); -// router.push('/login'); -// } +if (!accountStore.isLoggedIn) { + toast.add({ severity: 'error', summary: 'Error', detail: 'Please login first', life: 3000 }); + router.push('/login'); +} const name = ref(''); const description = ref(''); From 8015f9cda9e89c7ce548357cd2f466a7893f674a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD?= Date: Sun, 15 Dec 2024 05:47:55 +0800 Subject: [PATCH 20/30] feat(org): inrt ui --- src/views/org/create.vue | 60 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/src/views/org/create.vue b/src/views/org/create.vue index 5b8ec58..cee945d 100644 --- a/src/views/org/create.vue +++ b/src/views/org/create.vue @@ -1,10 +1,12 @@ @@ -105,36 +88,39 @@ const onCreateOrg = async () => {
-
-
- - -
- {{ - $form.Ogr_name.error.message }} -
- This will be the name of your - organization on AlgoHub. -
-
- - +
+
+ + +
+ + {{ + $form.org_name.error.message }} +
+ This will be the name of + your + organization on AlgoHub. +
+
+ + +
+ + {{ + $form.contact_email.error.message }}
- - {{ - $form.contact_email.error.message }} -
-
-
- - +
+
+ + +
+ {{ + $form.terms.error.message }}
- {{ - $form.terms.error.message }} -
- +
From 9dffdc84de5d6ba6eebce2bc3bdcc01ab79da363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=90=91=E5=A4=9C?= <46275354+fu050409@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:08:40 +0800 Subject: [PATCH 28/30] Update src/views/org/create.vue --- src/views/org/create.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/org/create.vue b/src/views/org/create.vue index 5e89edb..3687125 100644 --- a/src/views/org/create.vue +++ b/src/views/org/create.vue @@ -70,7 +70,8 @@ const onCreateOrg = async () => { toast.add({ severity: 'error', summary: 'Error', detail: res.message, life: 3000 }); }; inProgress.value = false; - router.push("/org/create" + res.data!.id); +// router.push("/org/create" + res.data!.id); +// TODO: redirect to organization home page } From caae6681c5dcdbcef777ede03524dcda74991cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD?= Date: Fri, 20 Dec 2024 16:26:39 +0800 Subject: [PATCH 29/30] chore(org): bump version --- .changes/org-create.md | 5 +++++ scripts/release-aur.mjs | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changes/org-create.md diff --git a/.changes/org-create.md b/.changes/org-create.md new file mode 100644 index 0000000..9848b3a --- /dev/null +++ b/.changes/org-create.md @@ -0,0 +1,5 @@ +--- +"algohub": patch:feat +--- + +Created a new org create page. \ No newline at end of file diff --git a/scripts/release-aur.mjs b/scripts/release-aur.mjs index 22f6a06..fafe63f 100644 --- a/scripts/release-aur.mjs +++ b/scripts/release-aur.mjs @@ -173,7 +173,6 @@ const releaseAur = defineCommand({ // Setup Git repository execSync("git add .", { stdio: "inherit", - cwd: "aur", }); execSync(`git -C aur config user.name "苏向夜"`, { stdio: "inherit" }); execSync(`git -C aur config user.email "fu050409@163.com"`, { From 8e69e087e8234245252dd2f3b2e26e2ec532aeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD?= Date: Fri, 20 Dec 2024 16:41:43 +0800 Subject: [PATCH 30/30] fix(scripts): fix release-aur --- scripts/release-aur.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release-aur.mjs b/scripts/release-aur.mjs index fafe63f..cea04ab 100644 --- a/scripts/release-aur.mjs +++ b/scripts/release-aur.mjs @@ -173,11 +173,11 @@ const releaseAur = defineCommand({ // Setup Git repository execSync("git add .", { stdio: "inherit", + cwd: "aur", }); execSync(`git -C aur config user.name "苏向夜"`, { stdio: "inherit" }); execSync(`git -C aur config user.email "fu050409@163.com"`, { stdio: "inherit", - cwd: "aur", }); // Test AUR package (skip in CI)