Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"tasks": [
{
"type": "npm",
"script": "lint:fix",
"script": "lint",
"path": "client",
"group": "none",
"problemMatcher": ["$eslint-stylish"],
"label": "npm run lint:fix - client",
"label": "npm run lint - client",
"detail": "eslint --fix"
},
{
Expand Down
2 changes: 2 additions & 0 deletions client/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ENV=DEVELOPMENT
VITE_BACKEND_URL="http://localhost:8000/api"
106 changes: 103 additions & 3 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
"type": "module",
"scripts": {
"dev": "vite --port 3000",
"build": "run-p type-check \"build-only {@}\" --",
"build": "run-p typecheck \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"typecheck": "vue-tsc --build --force",
"lint:fix": "eslint --fix",
"lint": "eslint --fix",
"lint:strict": "eslint",
"format": "prettier --write src/",
"format:check": "prettier --check src/"
},
"dependencies": {
"axios": "^1.7.7",
"pinia": "^2.2.6",
"vue": "^3.5.12",
"vue-router": "^4.4.5"
Expand Down
80 changes: 2 additions & 78 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,85 +1,9 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import { RouterView } from 'vue-router'
</script>

<template>
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />

<div class="wrapper">
<HelloWorld msg="You did it!" />

<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</div>
</header>

<RouterView />
</template>

<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}

.logo {
display: block;
margin: 0 auto 2rem;
}

nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}

nav a.router-link-exact-active {
color: var(--color-text);
}

nav a.router-link-exact-active:hover {
background-color: transparent;
}

nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
border: 0;
}

@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}

.logo {
margin: 0 2rem 0 0;
}

header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}

nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;

padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
<style></style>
2 changes: 1 addition & 1 deletion client/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ a,

#app {
display: grid;
grid-template-columns: 1fr 1fr;
/* grid-template-columns: 1fr 1fr; */
padding: 0 2rem;
}
}
8 changes: 0 additions & 8 deletions client/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ const router = createRouter({
name: 'home',
component: HomeView,
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue'),
},
],
})

Expand Down
4 changes: 4 additions & 0 deletions client/src/utils/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import axios from 'axios'

const server = axios.create({ baseURL: import.meta.env.VITE_BACKEND_URL, timeout: 8000 })
export default server
15 changes: 0 additions & 15 deletions client/src/views/AboutView.vue

This file was deleted.

54 changes: 50 additions & 4 deletions client/src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,55 @@
<script setup lang="ts">
import TheWelcome from '../components/TheWelcome.vue'
import { ref } from 'vue'
import server from '@/utils/server'

const isLoading = ref(false)
const healthcheckMessage = ref('')

const handlePing = async () => {
isLoading.value = true
healthcheckMessage.value = '' // Clear previous messages

try {
const response = await server.get('/healthcheck/ping/')
healthcheckMessage.value = response.data
} catch {
healthcheckMessage.value = 'Failed to ping server'
} finally {
isLoading.value = false
}
}
</script>

<template>
<main>
<TheWelcome />
</main>
<div id="healthcheck">
<h1>Healthcheck</h1>
<button id="ping" @click="handlePing" :disabled="isLoading">
{{ isLoading ? 'Loading' : 'Ping' }}
</button>
<p>
Response from server: <span>{{ healthcheckMessage }}</span>
</p>
</div>
</template>

<style scoped>
#healthcheck {
display: flex;
flex-direction: column;
place-items: center;
height: 80vh;
}

#ping {
background-color: var(--color-text);
color: var(--color-background);
border: none;
border-radius: 2px;
padding: 8px 16px;
margin: 8px;
}

#ping:hover {
filter: brightness(80%);
}
</style>
Loading