fix: formatting

This commit is contained in:
EETagent 2022-12-04 00:30:43 +01:00
parent 5f431fb92a
commit 23fab618db
23 changed files with 280 additions and 279 deletions

View file

@ -1,7 +1,7 @@
import { API_URL } from '$lib/@api'; import { API_URL } from '$lib/@api';
import type { HandleFetch } from '@sveltejs/kit'; import type { HandleFetch } from '@sveltejs/kit';
export const handleFetch: HandleFetch = async ({ request, fetch, event,}) => { export const handleFetch: HandleFetch = async ({ request, fetch, event }) => {
console.log(`SSR: handleFetch() BEFORE: ${request.method} ${request.url}`); console.log(`SSR: handleFetch() BEFORE: ${request.method} ${request.url}`);
const cookie = event.request.headers.get('cookie') || ''; const cookie = event.request.headers.get('cookie') || '';
@ -10,10 +10,7 @@ export const handleFetch: HandleFetch = async ({ request, fetch, event,}) => {
request.headers.set('cookie', cookie); request.headers.set('cookie', cookie);
request = new Request( request = new Request(request.url.replace(API_URL, 'http://127.0.0.1:8000'), request);
request.url.replace(API_URL, 'http://127.0.0.1:8000'),
request
);
console.log(`SSR: handleFetch() AFTER: ${request.method} ${request.url}`); console.log(`SSR: handleFetch() AFTER: ${request.method} ${request.url}`);

View file

@ -1,14 +1,14 @@
import type { AxiosError } from "axios"; import type { AxiosError } from 'axios';
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response> export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
export const API_URL = "http://localhost:8000"; export const API_URL = 'http://localhost:8000';
export interface ApiError { export interface ApiError {
error: AxiosError, error: AxiosError;
msg: string, msg: string;
} }
export function errorHandler(error: AxiosError, msg: string): ApiError { export function errorHandler(error: AxiosError, msg: string): ApiError {
return {error, msg} return { error, msg };
} }

View file

@ -1,23 +1,20 @@
<script lang="ts"> <script lang="ts">
import { fetchSubmProgress } from "$lib/stores/portfolio"; import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadCoverLetter } from "$lib/@api/candidate"; import { apiUploadCoverLetter } from '$lib/@api/candidate';
import DashboardUploadCard from "./DashboardUploadCard.svelte"; import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => { const onFileDrop = async (detail: any) => {
const file = detail.file; const file = detail.file;
const callback = detail.callback; const callback = detail.callback;
await apiUploadCoverLetter(file, callback); await apiUploadCoverLetter(file, callback);
await fetchSubmProgress(); await fetchSubmProgress();
} };
</script> </script>
<DashboardUploadCard <DashboardUploadCard
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={(e) => onFileDrop(e.detail)}
title="Motivační dopis" title="Motivační dopis"
filetype="PDF" filetype="PDF"
filesize={10} filesize={10}
fileType={1} fileType={1}
> />
</DashboardUploadCard>

View file

@ -1,22 +1,20 @@
<script lang="ts"> <script lang="ts">
import { fetchSubmProgress } from "$lib/stores/portfolio"; import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadPortfolioLetter } from "../../@api/candidate"; import { apiUploadPortfolioLetter } from '../../@api/candidate';
import DashboardUploadCard from "./DashboardUploadCard.svelte"; import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => { const onFileDrop = async (detail: any) => {
const file = detail.file; const file = detail.file;
const callback = detail.callback; const callback = detail.callback;
await apiUploadPortfolioLetter(file, callback); await apiUploadPortfolioLetter(file, callback);
await fetchSubmProgress(); await fetchSubmProgress();
} };
</script> </script>
<DashboardUploadCard <DashboardUploadCard
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={(e) => onFileDrop(e.detail)}
title="Portfolio" title="Portfolio"
filetype="PDF" filetype="PDF"
filesize={10} filesize={10}
fileType={2}> fileType={2}
</DashboardUploadCard> />

View file

@ -1,22 +1,20 @@
<script lang="ts"> <script lang="ts">
import { fetchSubmProgress } from "$lib/stores/portfolio"; import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadPortfolioZip } from "$lib/@api/candidate"; import { apiUploadPortfolioZip } from '$lib/@api/candidate';
import DashboardUploadCard from "./DashboardUploadCard.svelte"; import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => { const onFileDrop = async (detail: any) => {
const file = detail.file; const file = detail.file;
const callback = detail.callback; const callback = detail.callback;
await apiUploadPortfolioZip(file, callback); await apiUploadPortfolioZip(file, callback);
await fetchSubmProgress(); await fetchSubmProgress();
} };
</script> </script>
<DashboardUploadCard <DashboardUploadCard
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={(e) => onFileDrop(e.detail)}
title="Další data" title="Další data"
filetype="ZIP" filetype="ZIP"
filesize={100} filesize={100}
fileType={3}> fileType={3}
</DashboardUploadCard> />

View file

@ -3,19 +3,36 @@
</script> </script>
<div class="progress-bar"> <div class="progress-bar">
<svg class="animated animate-ease-linear" <svg
class="animated animate-ease-linear"
width="40mm" width="40mm"
height="8mm" height="8mm"
viewBox="0 0 50 6" viewBox="0 0 50 6"
version="1.1" version="1.1"
xmlns="http://www.w3.org/2000/svg"> xmlns="http://www.w3.org/2000/svg"
>
<line x1="5" y1="3" x2="45" y2="3" stroke="#e6e6e6" stroke-width="6" stroke-linecap="round" /> <line x1="5" y1="3" x2="45" y2="3" stroke="#e6e6e6" stroke-width="6" stroke-linecap="round" />
{#if progress === 1} {#if progress === 1}
<line x1="5" y1="3" x2={progress * 45} y2="3" stroke="#35e000ff" stroke-width="3" stroke-linecap="round" /> <line
x1="5"
y1="3"
x2={progress * 45}
y2="3"
stroke="#35e000ff"
stroke-width="3"
stroke-linecap="round"
/>
{:else} {:else}
<line x1="5" y1="3" x2={progress * 45} y2="3" stroke="#75bff8ff" stroke-width="3" stroke-linecap="round" /> <line
x1="5"
y1="3"
x2={progress * 45}
y2="3"
stroke="#75bff8ff"
stroke-width="3"
stroke-linecap="round"
/>
{/if} {/if}
> >
</svg> </svg>

View file

@ -1,23 +1,23 @@
<script lang="ts"> <script lang="ts">
import type { Status } from "$lib/stores/portfolio"; import type { Status } from '$lib/stores/portfolio';
import StatusNotificationDot from "./StatusNotificationDot.svelte"; import StatusNotificationDot from './StatusNotificationDot.svelte';
export let status: Status; export let status: Status;
let title: string; let title: string;
switch (status) { switch (status) {
case "submitted": case 'submitted':
title = "Soubory odeslány!"; title = 'Soubory odeslány!';
break; break;
case "uploaded": case 'uploaded':
title = "Soubory nahrány!"; title = 'Soubory nahrány!';
break; break;
case "missing": case 'missing':
title = "Chybí soubory!"; title = 'Chybí soubory!';
break; break;
} }
</script> </script>
<div class="bg-white rounded-full flex mb-8"> <div class="bg-white rounded-full flex mb-8">
<div class="mt-3 mb-3 ml-3 flex flex-row"> <div class="mt-3 mb-3 ml-3 flex flex-row">
<h2 class="ml-2 text-2xl text-sspsBlueDark font-bold">{title}</h2> <h2 class="ml-2 text-2xl text-sspsBlueDark font-bold">{title}</h2>
@ -39,4 +39,3 @@
@apply bg-[#ff3030ff]; @apply bg-[#ff3030ff];
} }
</style> </style>

View file

@ -1,21 +1,20 @@
<script lang="ts"> <script lang="ts">
import type { Status } from "$lib/stores/portfolio"; import type { Status } from '$lib/stores/portfolio';
export let status: Status; export let status: Status;
let title: string; let title: string;
$: switch (status) { $: switch (status) {
case "submitted": case 'submitted':
title = "Odeslané"; title = 'Odeslané';
break; break;
case "uploaded": case 'uploaded':
title = "Nahráno"; title = 'Nahráno';
break; break;
case "missing": case 'missing':
title = "Chybí"; title = 'Chybí';
break; break;
}; }
</script> </script>
<!-- make red dot --> <!-- make red dot -->
@ -40,11 +39,9 @@
.uploaded { .uploaded {
@apply bg-[#ff8530ff]; @apply bg-[#ff8530ff];
@apply animate-none; @apply animate-none;
} }
.missing { .missing {
@apply bg-red-700; @apply bg-red-700;
} }
</style> </style>

View file

@ -12,7 +12,8 @@
svg { svg {
@apply stroke-sspsBlue fill-sspsBlue; @apply stroke-sspsBlue fill-sspsBlue;
} }
g, path { g,
path {
@apply fill-sspsBlue stroke-sspsBlue; @apply fill-sspsBlue stroke-sspsBlue;
} }
</style> </style>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import lion from '$lib/assets/logo/lion.png'; import lion from '$lib/assets/logo/lion.png';
</script> </script>
<div <div
class="py-3 px-6 md:py-4 md:px-8 rounded-[999px] shadow-2xl flex items-center justify-center transition-all duration-700 hover:shadow-md" class="py-3 px-6 md:py-4 md:px-8 rounded-[999px] shadow-2xl flex items-center justify-center transition-all duration-700 hover:shadow-md"
> >
@ -8,5 +9,4 @@
</div> </div>
<style> <style>
</style> </style>

View file

@ -21,7 +21,7 @@
<style> <style>
.logo { .logo {
@apply w-[200px] h-[200px] @apply w-[200px] h-[200px];
} }
.bgImage { .bgImage {
@apply -z-20; @apply -z-20;

View file

@ -4,14 +4,17 @@
import DarkModeToggle from '../DarkModeToggle.svelte'; import DarkModeToggle from '../DarkModeToggle.svelte';
export let backgroundImage: string = defaultBg; export let backgroundImage: string = defaultBg;
export let backgroundPosition: string = "55%"; export let backgroundPosition: string = '55%';
</script> </script>
<div class="bg"> <div class="bg">
<div class="bgOverlay"> <div class="bgOverlay">
<img class="logo" src={logo} alt="SSPŠ logo" /> <img class="logo" src={logo} alt="SSPŠ logo" />
</div> </div>
<div style={`background-image: url(${backgroundImage}); background-position: ${backgroundPosition}`} class="bgImage" /> <div
style={`background-image: url(${backgroundImage}); background-position: ${backgroundPosition}`}
class="bgImage"
/>
</div> </div>
<div class="view"> <div class="view">
<div class="darkModeToggle"> <div class="darkModeToggle">

View file

@ -10,25 +10,18 @@
$: { $: {
let x = value.replace(/\D/g, '').match(/(\d{0,3})(\d{0,3})(\d{0,3})(\d{0,3})/)!; let x = value.replace(/\D/g, '').match(/(\d{0,3})(\d{0,3})(\d{0,3})(\d{0,3})/)!;
value = value =
(x[1] ? '+' + x[1] : '') + (x[2] ? ' ' + x[2] : '') + (x[3] ? ' ' + x[3] : '') + (x[4] ? ' ' + x[4] : ''); (x[1] ? '+' + x[1] : '') +
(x[2] ? ' ' + x[2] : '') +
(x[3] ? ' ' + x[3] : '') +
(x[4] ? ' ' + x[4] : '');
} }
</script> </script>
<TextField <TextField bind:error bind:value on:keydown on:keyup on:change type="tel" {placeholder} icon>
bind:error
bind:value
on:keydown
on:keyup
on:change
type="tel"
{placeholder}
icon
>
<div slot="icon" class="flex items-center justify-center"> <div slot="icon" class="flex items-center justify-center">
<Telephone /> <Telephone />
</div> </div>
</TextField> </TextField>
<style> <style>
</style> </style>

View file

@ -1,4 +1,4 @@
import { writable } from "svelte/store"; import { writable } from 'svelte/store';
export interface CandidateData { export interface CandidateData {
name?: string; name?: string;

View file

@ -1,5 +1,5 @@
import { apiFetchSubmissionProgress } from "../@api/candidate"; import { apiFetchSubmissionProgress } from '../@api/candidate';
import { writable } from "svelte/store"; import { writable } from 'svelte/store';
export type Status = 'submitted' | 'uploaded' | 'missing'; export type Status = 'submitted' | 'uploaded' | 'missing';
@ -7,7 +7,7 @@ export enum UploadStatus {
None = 1, None = 1,
Some = 2, Some = 2,
All = 3, All = 3,
Submitted = 4, Submitted = 4
} }
export interface SubmissionProgress { export interface SubmissionProgress {

View file

@ -43,7 +43,10 @@
name: yup.string().required(), name: yup.string().required(),
surname: yup.string(), surname: yup.string(),
email: yup.string().email().required(), email: yup.string().email().required(),
telephone: yup.string().required().matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/), telephone: yup
.string()
.required()
.matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/),
birthplace: yup.string().required(), birthplace: yup.string().required(),
birthdate: yup.string().required(), birthdate: yup.string().required(),
sex: yup.string(), sex: yup.string(),
@ -53,24 +56,27 @@
study: yup.string().required(), study: yup.string().required(),
parentName: yup.string(), parentName: yup.string(),
parentSurname: yup.string(), parentSurname: yup.string(),
parentTelephone: yup.string().required().matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/), parentTelephone: yup
.string()
.required()
.matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/),
parentEmail: yup.string().email().required() parentEmail: yup.string().email().required()
}), }),
onSubmit: async (values) => { onSubmit: async (values) => {
if (pageIndex === pageCount) { if (pageIndex === pageCount) {
try { try {
console.log("submit") console.log('submit');
// @ts-ignore // love javascript // @ts-ignore // love javascript
delete values.undefined; delete values.undefined;
values.birthdate = '2000-01-01' // TODO: reformat user typed date values.birthdate = '2000-01-01'; // TODO: reformat user typed date
await apiFillDetails(values); await apiFillDetails(values);
goto("/dashboard"); goto('/dashboard');
} catch (e) { } catch (e) {
console.error("error while submitting data: " + e); console.error('error while submitting data: ' + e);
}
} }
} }
},
}); });
$: console.log($errors); $: console.log($errors);
@ -84,7 +90,10 @@
break; break;
case 1: case 1:
if (/* $errors.birthdurname || */ $errors.birthplace || $errors.birthdate /* || $errors.sex */) { if (
/* $errors.birthdurname || */ $errors.birthplace ||
$errors.birthdate /* || $errors.sex */
) {
return true; return true;
} }
break; break;
@ -158,11 +167,7 @@
</p> </p>
<div class="flex flex-row md:flex-col w-full"> <div class="flex flex-row md:flex-col w-full">
<span class="w-full mt-8"> <span class="w-full mt-8">
<TextField <TextField type="text" placeholder="Rodné příjmení" on:change={handleChange} />
type="text"
placeholder="Rodné příjmení"
on:change={handleChange}
/>
</span> </span>
<span class="w-full mt-8 ml-2 md:ml-0"> <span class="w-full mt-8 ml-2 md:ml-0">
<TextField <TextField
@ -250,11 +255,7 @@
/> />
</span> </span>
<span class="w-full mt-8 ml-2 md:ml-0"> <span class="w-full mt-8 ml-2 md:ml-0">
<TextField <TextField on:change={handleChange} type="text" placeholder="Evidenční číslo přihlášky" />
on:change={handleChange}
type="text"
placeholder="Evidenční číslo přihlášky"
/>
</span> </span>
</div> </div>
<div class="mt-8 flex items-center justify-center w-full"> <div class="mt-8 flex items-center justify-center w-full">
@ -278,7 +279,7 @@
<input <input
on:click={async (e) => { on:click={async (e) => {
await handleSubmit(e); await handleSubmit(e);
console.log("clicked " + isPageInvalid()); console.log('clicked ' + isPageInvalid());
if (isPageInvalid()) return; if (isPageInvalid()) return;
if (pageIndex === pageCount) { if (pageIndex === pageCount) {
} else { } else {

View file

@ -4,9 +4,9 @@ export default defineConfig({
theme: { theme: {
extend: { extend: {
colors: { colors: {
"sspsBlue": '#406280', sspsBlue: '#406280',
"sspsBlueDark": '#243a55', sspsBlueDark: '#243a55',
"sspsGray": "#e6e6e6", sspsGray: '#e6e6e6'
} }
} }
} }