Skip to content

Commit 949dc19

Browse files
committed
client
1 parent d548e78 commit 949dc19

145 files changed

Lines changed: 4177 additions & 3376 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/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.d.ts
2+
*.min.css

client/.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"semi": false,
4+
"tabWidth": 4,
5+
"trailingComma": "all",
6+
"objectWrap": "collapse",
7+
"printWidth": 120
8+
}

client/.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "recommendations": ["Vue.volar", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] }

client/.vscode/settings.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
2+
"editor.codeActionsOnSave": { "source.fixAll": "explicit" },
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
25
"explorer.fileNesting.enabled": true,
36
"explorer.fileNesting.patterns": {
4-
"tsconfig.json": "tsconfig.*.json, *.d.ts, biome.json",
5-
"package.json": "package-lock.json"
7+
"tsconfig.json": "tsconfig*, *.d.ts",
8+
"package.json": "package-lock.json, eslint*, .prettier*"
69
},
7-
"[vue]": {
8-
"editor.defaultFormatter": "Vue.volar"
9-
}
10+
"[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }
1011
}

client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:24.2.0-bookworm-slim AS build
1+
FROM node:24.3.0-bookworm-slim AS build
22
COPY . .
33
RUN npm ci && npm run build
44

client/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# galahad-client
2+
23
Project setup: `npm install`
34
Compiles and hot-reloads for development: `npm run dev`
45
Compiles and minifies for production: `npm run build`
@@ -8,16 +9,26 @@ Lints and fixes files: `npm run lint`
89
[Configuration Reference](https://cli.vuejs.org/config/).
910

1011
# Dev overview
12+
1113
The following folders are found in src/
14+
1215
## Types
16+
1317
Typescript defined types, mostly to reflect the API response type.
18+
1419
## API
20+
1521
Interface to call the server.
22+
1623
## Stores
24+
1725
Pinia stores for application data. Retrieves data via the API and uploads data.
26+
1827
## Components
28+
1929
Vue components. Some core components like custom tables and buttons are prefixed with G- (short for Galahad).
2030
The interface is based around GTabs that can display different GCards in a tab-like interface.
2131

2232
## Views
33+
2334
Vue views. Views in the Annotate tab make use of the AnnotateTab component which handles errors like empty corpora or empty selections.

client/StyleTemplate.vue

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,57 @@
55
- https://vuejs.org/guide/typescript/composition-api.html -->
66

77
<!-- Attribute order: v-for/v-if; id; ref/key; v-model; others...; @click/@etc. -->
8-
<button v-if="visible" v-model="foo" class="btn" @click="handleClick">Button</button>
8+
<!-- within others, boolean arguments first, same-name linked props second, the rest third. -->
9+
<button v-if="visible" v-model="foo" primary bordered :color class="btn" @click="handleClick">Button</button>
910
</template>
1011

1112
<script setup lang="ts">
1213
// -- libraries --
14+
import axios from "axios"
1315
// --- stores ---
16+
import stores from "@/stores"
1417
// --- api ---
18+
import * as API from "@/api"
19+
// --- util ---
20+
import { formatDate } from "@/ts/utils"
1521
// --- views ---
22+
import HelpView from "@/views/HelpView.vue"
23+
1624
// --- types ---
25+
type myType = { id: number; name: string }
26+
1727
// --- model ---
1828
const model = defineModel<string>()
29+
1930
// --- props ---
20-
const { foo = "bar" } = defineProps<{
21-
foo?: string
22-
}>()
31+
const { foo = "bar" } = defineProps<{ foo?: string }>()
32+
2333
// --- emits ---
2434
// Defining emits is technically optional if they are not used in <script>, but it is a good practice to do so.
25-
const emit = defineEmits<{
26-
click: [name: string]
27-
voidExample: []
28-
}>()
35+
const emit = defineEmits<{ click: [name: string]; voidExample: [] }>()
36+
37+
// --- store data ---
38+
const store = stores.useMyStore()
39+
2940
// --- data ---
3041
const visible = ref<boolean>(true)
42+
3143
// --- computed ---
3244
const isVisible = computed<boolean>(() => visible.value) // arrow function where possible
45+
3346
// --- watch ---
47+
watch(
48+
() => store.someValue,
49+
(newValue, oldValue) => {
50+
console.log(`Value changed from ${oldValue} to ${newValue}`)
51+
},
52+
)
53+
3454
// --- lifecycle (in order of execution) ---
55+
onMounted((): void => {
56+
console.log("Component mounted")
57+
})
58+
3559
// --- methods ---
3660
function handleClick(): void {
3761
// do something

client/biome.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

client/components.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export {}
99
declare module 'vue' {
1010
export interface GlobalComponents {
1111
AnnotateTab: typeof import('./src/components/AnnotateTab.vue')['default']
12+
AnnotationSelect: typeof import('./src/components/input/AnnotationSelect.vue')['default']
1213
AppBanner: typeof import('./src/components/AppBanner.vue')['default']
1314
BenchmarkSetsHelp: typeof import('./src/components/help/BenchmarkSetsHelp.vue')['default']
1415
ComparisonModal: typeof import('./src/components/modals/ComparisonModal.vue')['default']
@@ -30,6 +31,8 @@ declare module 'vue' {
3031
GButton: typeof import('./src/components/input/GButton.vue')['default']
3132
GCard: typeof import('./src/components/GCard.vue')['default']
3233
GCheckBox: typeof import('./src/components/input/GCheckBox.vue')['default']
34+
GForm: typeof import('./src/components/input/GForm.vue')['default']
35+
GFormHorizontal: typeof import('./src/components/input/GFormHorizontal.vue')['default']
3336
GInfo: typeof import('./src/components/GInfo.vue')['default']
3437
GInput: typeof import('./src/components/input/GInput.vue')['default']
3538
GModal: typeof import('./src/components/modals/GModal.vue')['default']
@@ -58,6 +61,7 @@ declare module 'vue' {
5861
RouterLink: typeof import('vue-router')['RouterLink']
5962
RouterView: typeof import('vue-router')['RouterView']
6063
SingleTermComparisonTable: typeof import('./src/components/tables/SingleTermComparisonTable.vue')['default']
64+
TagsetSelect: typeof import('./src/components/input/TagsetSelect.vue')['default']
6165
UploadDocuments: typeof import('./src/components/input/UploadDocuments.vue')['default']
6266
UserList: typeof import('./src/components/modals/corpus/UserList.vue')['default']
6367
VariantsModal: typeof import('./src/components/modals/VariantsModal.vue')['default']

client/eslint.config.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { globalIgnores } from "eslint/config"
2+
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript"
3+
import pluginVue from "eslint-plugin-vue"
4+
import skipFormatting from "@vue/eslint-config-prettier/skip-formatting"
5+
6+
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
7+
// import { configureVueProject } from '@vue/eslint-config-typescript'
8+
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
9+
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
10+
11+
export default defineConfigWithVueTs(
12+
{
13+
name: "app/files-to-lint",
14+
files: ["**/*.{ts,mts,tsx,vue}"],
15+
rules: {
16+
"@typescript-eslint/no-unused-vars": [
17+
"error",
18+
{
19+
vars: "all",
20+
args: "after-used",
21+
ignoreRestSiblings: true,
22+
argsIgnorePattern: "^_",
23+
varsIgnorePattern: "^_",
24+
},
25+
],
26+
},
27+
},
28+
29+
globalIgnores(["**/dist/**", "**/dist-ssr/**", "**/coverage/**"]),
30+
31+
pluginVue.configs["flat/essential"],
32+
vueTsConfigs.recommended,
33+
skipFormatting,
34+
// allow unused variables with _ prefix
35+
)

0 commit comments

Comments
 (0)