Skip to content

Commit 569a5b0

Browse files
committed
More client refactro
1 parent d4b706c commit 569a5b0

109 files changed

Lines changed: 4311 additions & 4398 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/.vscode/settings.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"explorer.fileNesting.enabled": true,
3-
"explorer.fileNesting.patterns": {
4-
"tsconfig.json": "tsconfig.*.json, *.d.ts, biome.json",
5-
"package.json": "package-lock.json"
6-
}
2+
"explorer.fileNesting.enabled": true,
3+
"explorer.fileNesting.patterns": {
4+
"tsconfig.json": "tsconfig.*.json, *.d.ts, biome.json",
5+
"package.json": "package-lock.json"
6+
},
7+
"[vue]": {
8+
"editor.defaultFormatter": "Vue.volar"
9+
}
710
}

client/StyleTemplate.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// --- api ---
1515
// --- types ---
1616
// --- props ---
17-
const { foo = "bar" } = defineProps<{
17+
const {foo = "bar"} = defineProps<{
1818
foo?: string
1919
}>()
2020
// --- emits ---

client/biome.json

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3-
"vcs": {
4-
"enabled": false,
5-
"clientKind": "git",
6-
"useIgnoreFile": false
7-
},
8-
"files": {
9-
"ignoreUnknown": false,
10-
"ignore": []
11-
},
12-
"formatter": {
13-
"enabled": true,
14-
"indentStyle": "tab"
15-
},
16-
"organizeImports": {
17-
"enabled": true
18-
},
19-
"linter": {
20-
"enabled": true,
21-
"rules": {
22-
"recommended": true
23-
}
24-
},
25-
"javascript": {
26-
"formatter": {
27-
"quoteStyle": "double",
28-
"semicolons": "asNeeded"
29-
}
30-
}
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"linter": {
4+
"rules": {
5+
"all": true,
6+
"nursery": {
7+
"all": true
8+
},
9+
"correctness": {
10+
"noUndeclaredVariables": "off",
11+
"noUnusedVariables": "off",
12+
"useHookAtTopLevel": "off"
13+
}
14+
}
15+
},
16+
"formatter": {
17+
"formatWithErrors": true,
18+
"indentStyle": "space",
19+
"indentWidth": 4
20+
},
21+
"javascript": {
22+
"formatter": {
23+
"semicolons": "asNeeded",
24+
"arrowParentheses": "asNeeded",
25+
"bracketSameLine": true
26+
}
27+
}
3128
}

client/package.json

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
{
2-
"name": "galahad",
3-
"version": "0.0.0",
4-
"private": true,
5-
"type": "module",
6-
"scripts": {
7-
"dev": "vite",
8-
"build": "vite build"
9-
},
10-
"dependencies": {
11-
"@primeuix/themes": "^1.1.1",
12-
"axios": "^1.9.0",
13-
"content-disposition": "^0.5.4",
14-
"pinia": "^3.0.2",
15-
"primevue": "^4.3.4",
16-
"safe-buffer": "^5.2.1",
17-
"vue": "^3.5.14",
18-
"vue-router": "^4.5.1"
19-
},
20-
"devDependencies": {
21-
"@biomejs/biome": "^1.9.4",
22-
"@rollup/plugin-yaml": "^4.1.2",
23-
"@tsconfig/node24": "^24.0.0",
24-
"@types/node": "^22.15.19",
25-
"@vitejs/plugin-vue": "^5.2.4",
26-
"@vue/tsconfig": "^0.7.0",
27-
"sass-embedded": "^1.89.0",
28-
"typescript": "~5.8.3",
29-
"unplugin-auto-import": "^19.2.0",
30-
"unplugin-vue-components": "^28.5.0",
31-
"vite": "^6.3.5",
32-
"vite-plugin-node-polyfills": "^0.23.0",
33-
"vite-plugin-vue-devtools": "^7.7.6"
34-
}
2+
"name": "galahad",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vite build",
9+
"format": "biome format --write src/",
10+
"lint": "biome lint src/"
11+
},
12+
"dependencies": {
13+
"@primeuix/themes": "^1.1.1",
14+
"axios": "^1.9.0",
15+
"content-disposition": "^0.5.4",
16+
"pinia": "^3.0.2",
17+
"primevue": "^4.3.4",
18+
"safe-buffer": "^5.2.1",
19+
"vue": "^3.5.14",
20+
"vue-router": "^4.5.1"
21+
},
22+
"devDependencies": {
23+
"@biomejs/biome": "^1.9.4",
24+
"@rollup/plugin-yaml": "^4.1.2",
25+
"@tsconfig/node24": "^24.0.0",
26+
"@types/node": "^22.15.19",
27+
"@vitejs/plugin-vue": "^5.2.4",
28+
"@vue/tsconfig": "^0.7.0",
29+
"sass-embedded": "^1.89.0",
30+
"typescript": "~5.8.3",
31+
"unplugin-auto-import": "^19.2.0",
32+
"unplugin-vue-components": "^28.5.0",
33+
"vite": "^6.3.5",
34+
"vite-plugin-node-polyfills": "^0.23.0",
35+
"vite-plugin-vue-devtools": "^7.7.6"
36+
}
3537
}

client/src/App.vue

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<template>
2-
<GTabs
3-
class="level-1"
4-
basePath=""
5-
:tabs="[
6-
{ id: 'annotate', title: 'Annotate & Evaluate' },
7-
{ id: 'overview', title: 'Taggers & Datasets' },
8-
{ id: 'user', title: 'User' },
9-
]">
2+
<GTabs class="level-1" basePath="" :tabs="[
3+
{ id: 'annotate', title: 'Annotate & Evaluate' },
4+
{ id: 'overview', title: 'Taggers & Datasets' },
5+
{ id: 'user', title: 'User' },
6+
]">
107
<template #banner>
118
<AppBanner />
129
</template>
1310
</GTabs>
1411

1512
<GModal :show="appStore.errors.length > 0" title="Ocharme!" small @hide="appStore.resetErrors">
16-
<p>Please try again or contact <MailAddress /> for support.</p>
13+
<p>Please try again or contact
14+
<MailAddress /> for support.
15+
</p>
1716
<GInfo v-for="(error, i) in appStore.errors" :key="i" error>{{ error }}</GInfo>
1817
</GModal>
1918
</template>
@@ -26,7 +25,7 @@ const appStore = stores.useApp()
2625
const userStore = stores.useUser()
2726
2827
onMounted(() => {
29-
userStore.fetchUser()
28+
userStore.fetchUser()
3029
})
3130
</script>
3231

@@ -51,10 +50,6 @@ onMounted(() => {
5150
// }
5251
// }
5352
54-
// @media (max-width: 870px) {
55-
// .tabs.level-1 .header .tabs-start {
56-
// display: none;
57-
// }
5853
5954
// .tabs > .content {
6055
// padding: 10px 0 0 0 !important;

client/src/api/api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import axios from "axios"
77

88
// --- types ---
99
export type ErrorMessage = {
10-
statusCode: string
11-
message: string
10+
statusCode: string
11+
message: string
1212
}
1313

1414
// --- methods ---
@@ -17,8 +17,8 @@ export type ErrorMessage = {
1717
* or https://<hostname>/galahad/api/ if running in production.
1818
*/
1919
export const setAxiosBaseUrl = () => {
20-
axios.defaults.baseURL =
21-
location.hostname == "localhost"
22-
? `${location.protocol}//localhost:8010`
23-
: `${location.protocol}//${location.hostname}/galahad/api/`
20+
axios.defaults.baseURL =
21+
location.hostname === "localhost"
22+
? `${location.protocol}//localhost:8010`
23+
: `${location.protocol}//${location.hostname}/galahad/api/`
2424
}

client/src/api/benchmarks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* API for fetching benchmarks.
33
*/
44

5+
import type {Benchmarks} from "@/types/assays"
56
// --- libraries ---
67
import axios from "axios"
78
// --- types ---
8-
import type { AxiosResponse } from "axios"
9-
import type { Benchmarks } from "@/types/assays"
9+
import type {AxiosResponse} from "axios"
1010

1111
type BenchmarksResponse = AxiosResponse<Benchmarks>
1212

@@ -18,5 +18,5 @@ const benchmarksPath = "/benchmarks"
1818
* Fetch all benchmarks.
1919
*/
2020
export function getBenchmarks(): Promise<BenchmarksResponse> {
21-
return axios.get(benchmarksPath)
21+
return axios.get(benchmarksPath)
2222
}

client/src/api/corpora.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
* API calls for creating, updating, deleting a corpus, and fetching the list of corpora.
33
*/
44

5+
import type {CorpusMetadata, MutableCorpusMetadata, UUID} from "@/types/corpora"
56
// --- libraries ---
67
import axios from "axios"
78
// --- types ---
8-
import type { AxiosResponse } from "axios"
9-
import type {
10-
UUID,
11-
CorpusMetadata,
12-
MutableCorpusMetadata,
13-
} from "@/types/corpora"
9+
import type {AxiosResponse} from "axios"
1410

1511
type CorporaResponse = AxiosResponse<CorpusMetadata[]>
1612
type CorpusResponse = AxiosResponse<CorpusMetadata>
1713

1814
// --- data ---
19-
const corporaPath = `/corpora`
20-
const datasetCorporaPath = `/datasets_corpora`
15+
const corporaPath = "/corpora"
16+
const datasetCorporaPath = "/datasets_corpora"
2117

2218
// --- computed ---
2319
const corpusPath = (uuid: UUID) => `${corporaPath}/${uuid}`
@@ -28,40 +24,40 @@ const corpusPath = (uuid: UUID) => `${corporaPath}/${uuid}`
2824
* public (datasets), shared (collaborator/viewer), and owned.
2925
*/
3026
export function getCorpora(): Promise<CorporaResponse> {
31-
return axios.get(corporaPath)
27+
return axios.get(corporaPath)
3228
}
3329

3430
/**
3531
* Fetch a single corpus by UUID.
3632
* @param uuid UUID of corpus.
3733
*/
3834
export function getCorpus(uuid: UUID): Promise<CorpusResponse> {
39-
return axios.get(corpusPath(uuid))
35+
return axios.get(corpusPath(uuid))
4036
}
4137

4238
/**
4339
* Fetch all datasets. Note that all datasets are public. Cheaper than getCorpora().
4440
*/
4541
export function getDatasetCorpora(): Promise<CorporaResponse> {
46-
return axios.get(datasetCorporaPath)
42+
return axios.get(datasetCorporaPath)
4743
}
4844

4945
/**
5046
* Create a new corpus with the given metadata.
5147
* @param corpus Metadata of new corpus.
5248
*/
5349
export function postCorpus(
54-
corpus: MutableCorpusMetadata,
50+
corpus: MutableCorpusMetadata,
5551
): Promise<AxiosResponse<UUID>> {
56-
return axios.post(corporaPath, corpus)
52+
return axios.post(corporaPath, corpus)
5753
}
5854

5955
/**
6056
* Delete a corpus by UUID.
6157
* @param uuid UUID of corpus to delete.
6258
*/
6359
export function deleteCorpus(uuid: UUID) {
64-
return axios.delete(corpusPath(uuid))
60+
return axios.delete(corpusPath(uuid))
6561
}
6662

6763
/**
@@ -70,5 +66,5 @@ export function deleteCorpus(uuid: UUID) {
7066
* @param metadata New metadata.
7167
*/
7268
export function patchCorpus(uuid: UUID, metadata: MutableCorpusMetadata) {
73-
return axios.patch(corpusPath(uuid), metadata)
69+
return axios.patch(corpusPath(uuid), metadata)
7470
}

0 commit comments

Comments
 (0)