Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement api routes #16

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .eslintrc

This file was deleted.

67 changes: 67 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"root": true,
"ignorePatterns": ["dist/**", ".output/**", ".nuxt/**", "dockerdata/**"],
"extends": [
"eslint:recommended",
"plugin:json/recommended",
"plugin:vue/vue3-recommended",
"plugin:@typescript-eslint/recommended",
"@nuxtjs/eslint-config-typescript",
"plugin:prettier/recommended"
],
"plugins": ["json", "nuxt", "@typescript-eslint"],
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"parser": "@typescript-eslint/parser"
},
"env": {
"browser": true,
"es2021": true,
"node": true
},
"rules": {
"no-unused-vars": "off",
"no-console": ["warn", { "allow": ["info", "warn", "error"] }],
"no-use-before-define": "off",
"no-empty": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"vue/multi-word-component-names": "off",
"vue/no-multiple-template-root": "off",
"vue/component-api-style": ["error", ["script-setup"]],
"vue/define-emits-declaration": ["error", "type-based"],
"vue/block-lang": [
"error",
{
"script": {
"lang": "ts"
},
"style": {
"lang": "scss"
}
}
],
"vue/block-tag-newline": [
"error",
{
"singleline": "consistent",
"multiline": "always",
"maxEmptyLines": 1
}
],
"vue/component-tags-order": [
"error",
{
"order": ["template", "script", "style"]
}
],
"vue/component-name-in-template-casing": [
"error",
"PascalCase",
{
"registeredComponentsOnly": false
}
]
}
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ node_modules
# System files
*.log

.env
.env

# Yarn >= v2
.yarn
11 changes: 5 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "none",
"vueIndentScriptAndStyle": false
}
"trailingComma": "all",
"semi": true,
"singleQuote": false,
"quoteProps": "consistent"
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
4 changes: 0 additions & 4 deletions app.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<template>
<NuxtPage />
</template>

<script lang="ts" setup>
import '~/assets/css/tailwind.css';
</script>
2 changes: 1 addition & 1 deletion assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Dit is de map voor dingen zoals het CSS-bestand voor TailwindCSS en ook plaatjes.

Kijk [hier](https://v3.nuxtjs.org/docs/directory-structure/assets) voor meer informatie.
Kijk [hier](https://nuxt.com/docs/guide/directory-structure/assets) voor meer informatie.
8 changes: 3 additions & 5 deletions components/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<slot name="header">Header</slot>
</h2>

<ph-caret-down
weight="bold"
<Icon
name="ph:caret-down"
:class="[
'icon text-primary-700 transition-transform',
'font-bold text-primary-700 transition-transform',
isCollapsed ? '-rotate-90' : ''
]"
/>
Expand All @@ -33,8 +33,6 @@
</template>

<script lang="ts" setup>
import { PhCaretDown } from 'phosphor-vue';

interface Props {
index: number; // The index of the current Accordion in its container
selectedAccordion: number; // The index of the selected Accordion (used to collapse or expand the current Accordion)
Expand Down
4 changes: 2 additions & 2 deletions components/SlideOver.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
<span class="sr-only">
Close panel
</span>
<ph-x
<Icon
name="ph:x"
class="h-6 w-6"
aria-hidden="true"
/>
Expand Down Expand Up @@ -115,7 +116,6 @@ import {
TransitionChild,
TransitionRoot
} from '@headlessui/vue';
import { PhX } from 'phosphor-vue';

interface Props {
open: boolean; // Say if the SlideOver should be shown
Expand Down
31 changes: 16 additions & 15 deletions components/Toast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div
v-if="active && !toast.primary"
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'bg-danger-600'
: 'bg-white',
'relative overflow-hidden rounded-lg p-3 shadow-lg'
Expand All @@ -31,7 +31,7 @@
<p
v-if="toast.title"
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-100'
: 'text-gray-900',
'text-sm font-medium leading-5'
Expand All @@ -41,7 +41,7 @@
</p>
<p
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-200'
: 'text-gray-500',
toast.title ? 'mt-1' : ''
Expand All @@ -55,13 +55,14 @@
class="inline-flex text-gray-400 transition duration-150 ease-in-out focus:text-gray-500 focus:outline-none"
@click="destroy"
>
<ph-x
<Icon
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-300'
: 'text-gray-400',
'h-4 w-4'
]"
name="ph:x"
/>
</button>
</div>
Expand All @@ -70,7 +71,7 @@
<div
v-if="active && toast.primary && toast.secondary"
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'bg-danger-600'
: 'bg-white',
'rounded-lg shadow-lg'
Expand All @@ -83,7 +84,7 @@
<p
v-if="toast.title"
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-100'
: 'text-gray-900',
'text-sm font-medium leading-5'
Expand All @@ -93,7 +94,7 @@
</p>
<p
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-200'
: 'text-gray-500',
toast.title ? 'mt-1' : ''
Expand All @@ -111,7 +112,7 @@
<button
class="flex w-full items-center justify-center rounded-tr-lg border border-transparent px-4 py-1 text-sm font-medium leading-5 transition duration-150 ease-in-out focus:outline-none"
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-100'
: 'focus:shadow-outline-blue text-secondary-500 hover:text-secondary-400'
]"
Expand All @@ -124,7 +125,7 @@
<button
class="flex w-full items-center justify-center rounded-br-lg border border-transparent px-4 py-1 text-sm font-medium leading-5 transition duration-150 ease-in-out focus:outline-none"
:class="
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? ''
: 'focus:shadow-outline-blue text-gray-700 hover:text-gray-500 active:bg-gray-50 active:text-gray-800'
"
Expand All @@ -140,7 +141,7 @@
<div
v-if="active && toast.primary && !toast.secondary"
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'bg-danger-600'
: 'bg-white',
'rounded-lg shadow-lg'
Expand All @@ -157,7 +158,7 @@
<button
class="ml-3 shrink-0 text-sm font-medium leading-5 transition duration-150 ease-in-out focus:outline-none"
:class="
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? ''
: 'text-secondary-500 hover:text-secondary-400'
"
Expand All @@ -171,13 +172,14 @@
class="inline-flex text-gray-400 transition duration-150 ease-in-out focus:text-gray-500 focus:outline-none"
@click="destroy"
>
<ph-x
<Icon
:class="[
toast.type == ToastType.DENIED
toast.type === ToastType.DENIED
? 'text-danger-300'
: 'text-gray-400',
'h-4 w-4'
]"
name="ph:x"
/>
</button>
</div>
Expand All @@ -192,7 +194,6 @@

<script lang="ts" setup>
import { TransitionChild, TransitionRoot } from '@headlessui/vue';
import { PhX } from 'phosphor-vue';

import { Toast, ToastType } from '~~/models/toast';

Expand Down
13 changes: 5 additions & 8 deletions components/ToastIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
v-if="type === ToastType.SUCCESS"
class="rounded-full border-2 border-success-200 p-0.5"
>
<ph-check class="h-4 w-4 text-success-400" />
<Icon name="ph:check" class="h-4 w-4 text-success-400" />
</div>
<div
v-if="type === ToastType.INFO"
Expand Down Expand Up @@ -40,18 +40,15 @@
v-if="type === ToastType.DENIED"
class="rounded-full border-2 border-danger-200 p-0.5"
>
<ph-x class="h-4 w-4 text-danger-100" />
<Icon name="ph:x" class="h-4 w-4 text-danger-100" />
</div>
</div>
</template>

<script lang="ts" setup>
import { PhX } from 'phosphor-vue';
import { ToastType } from '~~/models/toast';

interface Props {
type: ToastType;
}

const props = defineProps<Props>();
const props = defineProps<{
type: ToastType;
}>();
</script>
11 changes: 4 additions & 7 deletions components/blocks/AssignItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
<div
class="group flex cursor-move items-center gap-2 rounded-md border border-gray-200 bg-white py-2 pr-3 text-primary-900 hover:bg-secondary-50"
>
<ph-dots-six-vertical
class="icon mx-1 text-white group-hover:text-primary-400"
<Icon
name="ph:dots-six-vertical"
class="mx-1 text-white group-hover:text-primary-400"
aria-hidden="true"
/>

<slot />

<ph-users-three class="icon text-primary-400" aria-hidden="true" />
<Icon name="ph:users-three" class="text-primary-400" aria-hidden="true" />

<span class="text-xs font-medium">
<slot name="number-crews" />
</span>
</div>
</template>

<script lang="ts" setup>
import { PhDotsSixVertical, PhUsersThree } from 'phosphor-vue';
</script>
7 changes: 3 additions & 4 deletions components/blocks/BlocksMovingPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@

<template #teams="{ item }">
<div class="flex items-center gap-2">
<ph-users-three
class="icon text-primary-400"
<Icon
name="ph:users-three"
class="text-primary-400"
aria-hidden="true"
/>

Expand All @@ -85,8 +86,6 @@
</template>

<script lang="ts" setup>
import { PhUsersThree } from 'phosphor-vue';

import { useBlockStore } from '~~/stores/block';
import { useCrewStore } from '~~/stores/crew';
import { useEventStore } from '~~/stores/event';
Expand Down
4 changes: 2 additions & 2 deletions components/blocks/BlocksSlideOver.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
@cancel="$emit('cancel')"
>
<template #header>
<span v-if="state == SlideOverState.ADD">Create a new block</span>
<span v-if="state === SlideOverState.ADD">Create a new block</span>
<span v-else>Edit this block</span>
</template>
<template #subheader>
<span v-if="state == SlideOverState.ADD">
<span v-if="state === SlideOverState.ADD">
Create a new block for this regatta.
</span>
</template>
Expand Down
Loading