Compare commits

...

13 commits

Author SHA1 Message Date
220d4b1f30 add: new design
New design
2025-05-10 13:01:21 +02:00
ae0f6cb620 add: data from MongoDB
Retrieve Data from MongoDB
2025-05-10 12:56:57 +02:00
628659c39d add: new design
New design
2025-05-10 11:43:35 +02:00
192b031140 add: new design (wip)
New design as WIP, swipe controls
2025-05-10 11:24:46 +02:00
3200c29c2f add: new design (wip)
New design as WIP, swipe controls
2025-05-10 11:13:25 +02:00
7af148058e add: new design (wip)
New design as WIP, swipe controls
2025-05-10 11:07:06 +02:00
259adf53f6 fix: design adjustments
Smaller name, ellipsis for long name, indicator for number of roles/sheets/layers
2025-05-09 20:22:38 +02:00
8ccedbed8a fix: design adjustments
Smaller name, ellipsis for long name, indicator for number of roles/sheets/layers
2025-05-09 20:09:12 +02:00
c5be0b6b04 fix: replace bug
Fixed missing fallback for old local storage saves
2025-05-06 08:21:58 +02:00
8f924151da add: new price card design
Bigger header, icons for deletion and edit, form validation
2025-05-05 20:40:17 +02:00
7aa21c1c19 add: new price card
Added new price card design, wip
2025-04-28 21:07:04 +02:00
9d686e2af2 add: ssg
Added ssg config
2025-04-21 09:56:22 +02:00
eabd67f93e add: imp, privacy
Add imprint and privacy stuff
2025-04-21 09:53:25 +02:00
27 changed files with 10356 additions and 2725 deletions

View file

@ -1,75 +1 @@
# Nuxt Minimal Starter # TBD
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

View file

@ -1,7 +1,7 @@
.Button { .Button {
--padding: .2rem; --padding: .2rem;
--background: var(--color-main); --background: var(--color-gradient-main-dark);
--color: var(--color-white); --color: var(--color-lightest);
--background-hover: var(--color-main-dark); --background-hover: var(--color-main-dark);
position: relative; position: relative;
@ -13,9 +13,58 @@
transition: var(--transition-default); transition: var(--transition-default);
outline: none; outline: none;
border: none; border: none;
background: transparent; background: var(--background);
color: var(--color); color: var(--color);
&.transparent {
--background: transparent;
box-shadow: none;
padding: .5em 1.5em;
border-radius: var(--radius-default);
}
&.raised {
box-shadow: var(--box-shadow-z2);
padding: .5em 1.5em;
border-radius: var(--radius-default);
&.danger {
--background: var(--color-gradient-error);
--color: var(--color-lightest);
}
}
&.text {
--background: transparent;
--color: var(--color-darkest);
padding: .5em 1.5em;
border-radius: var(--radius-default);
&:hover {
--background: rgba(0, 0, 0, 0.05);
}
&.white {
--color: var(--color-lightest);
}
&.danger {
--color: var(--color-error);
&:hover {
--background: rgba(255, 0, 0, 0.1);
}
}
}
&.round {
display: flex;
justify-content: center;
align-items: center;
border-radius: 100%;
padding: .5rem;
}
&.cta { &.cta {
background: var(--background); background: var(--background);
color: var(--color); color: var(--color);
@ -29,9 +78,9 @@
} }
&.cta.white { &.cta.white {
--background: var(--color-white); --background: var(--color-lightest);
--color: var(--color-main); --color: var(--color-main);
--background-hover: var(--color-grey); --background-hover: var(--color-light);
} }
&.icon-button { &.icon-button {

View file

@ -1,9 +1,13 @@
.ButtonGroup { .ButtonGroup {
display: flex; display: flex;
background: var(--color-main);
border-radius: var(--radius-default);
overflow: hidden;
box-shadow: var(--box-shadow-z2);
& button { & button {
--color: var(--color-white-transparent); --color: var(--color-light);
--background: var(--color-main); --background: var(--color-main-darkest);
all: unset; all: unset;
display: flex; display: flex;
align-items: center; align-items: center;
@ -17,7 +21,7 @@
transition: var(--transition-default); transition: var(--transition-default);
&.active { &.active {
--color: var(--color-white); --color: var(--color-lightest);
--background: var(--color-main-dark); --background: var(--color-main-dark);
} }

View file

@ -1,9 +1,11 @@
.Footer { .Footer {
background: var(--color-main-dark); position: relative;
background: var(--color-darkest);
padding: 1rem; padding: 1rem;
z-index: 100;
& h4 { & h4 {
color: var(--color-white); color: var(--color-lightest);
text-align: center; text-align: center;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
@ -12,7 +14,7 @@
display: flex; display: flex;
gap: 1rem; gap: 1rem;
justify-content: space-between; justify-content: space-between;
color: var(--color-white-transparent); color: var(--color-light);
} }
& .socials { & .socials {
@ -33,7 +35,7 @@
gap: 1rem; gap: 1rem;
& a { & a {
color: var(--color-white); color: var(--color-lightest);
text-decoration: none; text-decoration: none;
} }
} }

View file

@ -1,44 +1,52 @@
.Input { .Input {
&.error {
& .input-wrapper {
border-color: var(--color-error);
outline-width: 2px;
}
& span {
color: var(--color-error);
}
}
& span {
font-size: .65em;
}
& .input-wrapper {
position: relative; position: relative;
flex: 25% 1 0; flex: 25% 1 0;
border: 2px solid var(--color-blue); border: 2px solid var(--color-main-dark);
border-radius: var(--radius-default); border-radius: var(--radius-default);
overflow: hidden; overflow: hidden;
transition: var(--transition-default); transition: var(--transition-default);
outline: 0 solid var(--color-white); outline: 0 solid var(--color-lightest);
& label { & label {
position: absolute; position: absolute;
font-size: .8em;
top: .3rem;
left: .5rem; left: .5rem;
font-size: 1.5em;
top: .7rem;
transition: var(--transition-default); transition: var(--transition-default);
} }
& input { & input {
all: unset; all: unset;
width: calc(100% - 1rem); width: calc(100% - 1rem);
font-size: 1.2em;
padding: 1.3rem .5rem .5rem .5rem; padding: 1.3rem .5rem .5rem .5rem;
background: var(--color-white); background: var(--color-lightest);
&[type="number"] { &[type="number"] {
text-align: right; text-align: right;
} }
} }
&:has(input:invalid) {
border-color: var(--color-red);
outline-width: 2px;
}
& input:focus, & input:focus,
& input:not(:placeholder-shown) { & input:not(:placeholder-shown) {
& + label { & + label {
color: var(--color-main); color: var(--color-main-dark);
font-size: 1em; }
top: .3rem;
right: .5rem;
} }
} }
} }

View file

@ -1,27 +1,50 @@
:root { :root {
--padding-default: 1rem; --padding-default: 1rem;
--radius-default: 5px; --padding-small: .5rem;
--radius-default: 3px;
--transition-default: 150ms; --transition-default: 150ms;
--color-white: white; --color-success: #328104;
--color-white-transparent: rgba(255, 255, 255, 0.67); --color-error: #A20606;
--color-red: #cc0001; --color-blue-light: #0DDCE7;
--color-blue-light: #61a7fd; --color-blue: #05B0FF;
--color-blue: #2e86de; --color-blue-dark: #0266F2;
--color-blue-dark: #1b4b7f; --color-blue-darkest: #013174;
--color-grey: #c7c7c7;
--color-darkest: #292929;
--color-dark: #404040;
--color-middle: #707070;
--color-light: #E0E0E6;
--color-lightest: #FAFAFF;
--color-green-light: #05FFC5;
--color-green: #02F276;
--color-green-dark: #09DC33;
--color-green-darkest: #07B029;
--color-green-darkest-most: #157C2A;
--color-orange: #DE9C2F;
--color-main: var(--color-blue); --color-main: var(--color-blue);
--color-main-light: var(--color-blue-light); --color-main-light: var(--color-blue-light);
--color-main-dark: var(--color-blue-dark); --color-main-dark: var(--color-blue-dark);
--color-main-darkest: var(--color-blue-darkest);
--color-accent: var(--color-orange); --color-accent: var(--color-green);
--color-accent-light: var(--color-green-light);
--color-accent-dark: var(--color-green-dark);
--color-accent-darkest: var(--color-green-darkest);
--color-gradient-main: linear-gradient(to bottom right, var(--color-main), var(--color-main-light));
--color-gradient-main-dark: linear-gradient(to bottom right, var(--color-main-darkest), var(--color-main-dark));
--color-gradient-accent: linear-gradient(to bottom right, var(--color-accent), var(--color-accent-light));
--color-gradient-accent-dark: linear-gradient(to bottom right, var(--color-accent-darkest), var(--color-accent-dark));
--color-gradient-error: linear-gradient(to bottom right, #B00707, #DC0909);
--color-gradient-error-reverse: linear-gradient(to top left, #B00707, #DC0909);
--box-shadow-upper: 0 -3px 6px rgba(0,0,0,0.16), 0 -3px 6px rgba(0,0,0,0.23); --box-shadow-upper: 0 -3px 6px rgba(0,0,0,0.16), 0 -3px 6px rgba(0,0,0,0.23);
--box-shadow-z2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); --box-shadow-z2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
--box-shadow-inset: inset 0 3px 6px rgba(0,0,0,0.16), inset 0 3px 6px rgba(0,0,0,0.23); --box-shadow-inset: inset 0 3px 6px rgba(0,0,0,0.16), inset 0 3px 6px rgba(0,0,0,0.23);
} }
* { * {
@ -35,6 +58,7 @@ body {
height: 100%; height: 100%;
overflow-x: hidden; overflow-x: hidden;
font-family: sans-serif; font-family: sans-serif;
color: var(--color-darkest);
} }
.dot { .dot {
@ -77,7 +101,6 @@ body {
.card { .card {
overflow: hidden; overflow: hidden;
border-radius: var(--radius-default); border-radius: var(--radius-default);
border: 1px solid var(--color-main);
box-shadow: var(--box-shadow-z2); box-shadow: var(--box-shadow-z2);
} }
@ -106,7 +129,7 @@ body {
} }
.text-white { .text-white {
color: var(--color-white); color: var(--color-lightest);
} }
.bg-main { .bg-main {
@ -124,3 +147,49 @@ body {
.bg-main-dark-hover:hover { .bg-main-dark-hover:hover {
background-color: var(--color-main-dark); background-color: var(--color-main-dark);
} }
.gap-default {
gap: 1rem;
}
.bg-blue {
background: var(--color-blue);
}
.bg-white {
background: var(--color-lightest);
}
.padding {
gap: 1rem;
padding: var(--padding-default);
}
.padding-small {
gap: 1rem;
padding: var(--padding-small);
}
dialog {
top: 50%;
left: 50%;
width: 100vw;
transform: translate(-50%, -50%);
border: none;
border-radius: var(--radius-default);
font-size: 1rem;
& header {
justify-content: space-between;
align-items: center;
}
& footer {
justify-content: space-between;
}
&::backdrop {
background: rgba(0, 0, 0, 0.5);
}
}

View file

@ -3,16 +3,19 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: var(--padding-default); padding: var(--padding-default);
background-color: var(--color-white); background-color: rgba(255 255 255 / .8);
backdrop-filter: blur(10px);
box-shadow: var(--box-shadow-z2); box-shadow: var(--box-shadow-z2);
color: var(--color-darkest);
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 1; z-index: 100;
& strong { & strong {
font-size: 2em; font-size: 2em;
& span { & span {
color: var(--color-main); color: var(--color-main-dark);
} }
} }
@ -38,7 +41,7 @@
top: 0; top: 0;
height: 100dvh; height: 100dvh;
transition: 150ms ease-in-out; transition: 150ms ease-in-out;
background: var(--color-white); background: var(--color-lightest);
font-size: 2em; font-size: 2em;
align-items: end; align-items: end;
z-index: 100; z-index: 100;
@ -49,6 +52,17 @@
align-items: center; align-items: center;
& li { & li {
list-style: none; list-style: none;
& a {
color: var(--color-black);
text-decoration: none;
transition: var(--transition-default);
&.active {
color: var(--color-main);
font-weight: bold;
}
}
} }
} }
} }

View file

@ -1,62 +1,87 @@
.PriceCard { .PriceCard {
position: relative;
overflow: hidden;
width: 100%; width: 100%;
display: grid;
transition: 150ms; transition: 150ms;
grid-template-rows: auto 1fr auto;
max-height: 400px;
opacity: 1; opacity: 1;
color: var(--color-darkest);
background: black;
&.deleting { .bottom {
max-height: 0; position: absolute;
opacity: 0; z-index: 1;
display: flex;
align-items: stretch;
width: 100%;
height: 100%;
& > * {
flex-grow: 1;
color: var(--color-lightest);
font-size: 2rem;
display: flex;
align-items: center;
& .icon {
filter: drop-shadow(1px 3px 1px rgb(0 0 0 / 0.4));
}
} }
&.folded { & .bg-edit {
grid-template-rows: auto 0fr auto; background: var(--color-gradient-main-dark);
padding: 2rem;
text-align: left;
}
& .bg-delete {
background: var(--color-gradient-error-reverse);
padding: 2rem;
text-align: right;
justify-content: flex-end;
}
}
.top {
position: relative;
background: var(--color-lightest);
z-index: 2;
gap: 1rem;
padding: 1rem;
border-radius: var(--radius-default);
&.animated {
transition: var(--transition-default);
} }
& > header { & > header {
color: var(--color-white);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
font-size: 1.3em; color: var(--color-darkest);
& > .Button { & .icon {
color: var(--color-white); font-size: 1rem;
border: 2px solid var(--color-white); cursor: pointer;
} }
} }
& aside { & .name-price {
display: flex;
gap: .5rem;
& > span:nth-child(1) {
font-weight: bold;
max-width: 210px;
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis;
} }
& footer { & > span:nth-child(2)::before {
display: flex; content: '•';
justify-content: space-between; margin-right: .5rem;
align-items: center; color: var(--color-middle);
& > .Button.delete {
scale: 0;
} }
& > .Button.deletable {
scale: 1;
}
}
& .padding {
gap: 1rem;
padding: var(--padding-default);
}
& .bg-blue {
background: var(--color-blue);
}
& .bg-white {
background: var(--color-white);
} }
& .wrapper { & .wrapper {
@ -66,28 +91,27 @@
gap: 1rem; gap: 1rem;
justify-content: space-between; justify-content: space-between;
& > * {
flex-basis: 25%;
flex-grow: 1;
}
& > .info { & > .info {
flex-grow: 0;
align-items: center; align-items: center;
gap: .25rem;
& > .icon { font-weight: bold;
color: var(--color-blue-light);
font-size: 2rem;
padding: .2rem;
}
& > .price { & > .price {
font-size: 1.2rem; display: flex;
align-items: center;
gap: .5rem;
& > .icon {
color: var(--color-main-dark);
}
} }
& > .pro { & > .pro {
font-size: .8rem; font-size: .6rem;
font-weight: bold; color: var(--color-middle);
color: var(--color-main-light); font-weight: lighter;
}
} }
} }
} }

View file

@ -1,9 +1,10 @@
.Toolbar { .Toolbar {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
background: var(--color-main); background: var(--color-main-darkest);
position: sticky; position: sticky;
bottom: 0; bottom: 0;
z-index: 100;
box-shadow: var(--box-shadow-upper); box-shadow: var(--box-shadow-upper);
& > .Button { & > .Button {

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="ButtonGroup"> <div class="ButtonGroup z-2">
<button <button
v-for="(button, index) in buttons" v-for="(button, index) in buttons"
@click="click(index)" @click="click(index)"

View file

@ -0,0 +1,39 @@
<template>
<dialog
ref="dialog"
closedby="any"
>
<form method="dialog">
<header class="flex-row padding">
Wirklich löschen?
<PpButton class="round text">
<Icon name="uil:times" mode="svg" />
</PpButton>
</header>
<main>
<div class="padding flex-col">
<p>Bist du dir sicher, dass du diesen Eintrag löschen möchtest?</p>
</div>
</main>
<footer class="flex-row padding">
<PpButton class="text">
<span>Abbrechen</span>
</PpButton>
<PpButton class="danger raised" @click="$emit('delete')">
<span>Löschen</span>
</PpButton>
</footer>
</form>
</dialog>
</template>
<script setup lang="ts">
type Props = {
currentCardIndex : number
}
defineProps<Props>()
defineEmits(['delete'])
</script>

View file

@ -1,9 +1,10 @@
<template> <template>
<div class="Input flex-col"> <div class="Input">
<div class="input-wrapper flex-col">
<input <input
v-model="text" v-model="text"
:type="type" :type="type"
:id="makeId()" :id="id"
:step="step" :step="step"
:min="min" :min="min"
:max="max" :max="max"
@ -11,7 +12,9 @@
placeholder=" " placeholder=" "
@blur="emit('blur')" @blur="emit('blur')"
/> />
<label :for="makeId()">{{ label }}</label> <label :for="id">{{ label }}</label>
</div>
<span v-if="message">{{ message }}</span>
</div> </div>
</template> </template>
@ -22,9 +25,9 @@ type Props = {
min ?: number min ?: number
step ?: number step ?: number
required ?: boolean required ?: boolean
message ?: string
label : string label : string
id : string id : string
uid : string
} }
const { const {
@ -32,15 +35,9 @@ const {
required = false, required = false,
step = 0.01, step = 0.01,
min = 1, min = 1,
max,
label,
id,
uid,
} = defineProps<Props>() } = defineProps<Props>()
const emit = defineEmits(['blur']) const emit = defineEmits(['blur'])
const text = defineModel() const text = defineModel()
const makeId = () => `${id}_${uid}`
</script> </script>

View file

@ -1,22 +1,56 @@
<template> <template>
<header class="Header"> <header class="Header">
<NuxtLink to="/">
<strong><span>Pro</span>Papier</strong> <strong><span>Pro</span>Papier</strong>
<label for="burger_nav_toggle" v-if="available"> </NuxtLink>
<label for="burger_nav_toggle">
<Icon name="solar:hamburger-menu-broken" size="2em" /> <Icon name="solar:hamburger-menu-broken" size="2em" />
</label> </label>
<input type="checkbox" id="burger_nav_toggle" v-if="available" /> <input ref="checkbox" type="checkbox" id="burger_nav_toggle"/>
<nav class="flex-col" v-if="available"> <nav class="flex-col">
<label for="burger_nav_toggle"> <label for="burger_nav_toggle">
<Icon name="solar:close-circle-broken" /> <Icon name="solar:close-circle-broken" />
</label> </label>
<ul class="flex-col"> <ul class="flex-col">
<li>Home</li> <li v-for="navPoint in navPoints" :key="navPoint.label">
<li>Übersicht</li> <NuxtLink
:to="navPoint.to"
active-class="active"
@click="closeNav()"
>
{{ navPoint.label }}
</NuxtLink>
</li>
</ul> </ul>
</nav> </nav>
</header> </header>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const available = false type NavPoint = {
label: string
to: string
}
const navPoints = useState<NavPoint[]>('nav', () => ([
{
label: 'Home',
to: '/',
},
{
label: 'Übersicht',
to: '/overview',
},
]))
const cb = useTemplateRef('checkbox')
const closeNav = () => { cb.value!.checked = false }
</script> </script>
<style scoped>
header a {
text-decoration: none;
color: var(--color-darkest);
}
</style>

View file

@ -1,64 +1,59 @@
<template> <template>
<form <article class="PriceCard card">
ref="root" <div class="bottom">
class="PriceCard card" <div class="bg-edit">
:class="{ folded, deleting }" <Icon class="icon" name="uil:pen" mode="svg" />
@submit.prevent="() => {}" </div>
<div class="bg-delete">
<Icon class="icon" name="uil:trash-alt" mode="svg" />
</div>
</div>
<div
ref="top"
class="top flex-col"
:class="{ 'animated' : !isSwiping }"
:style="{ left }"
> >
<header class="padding bg-blue"> <header>
{{ card.name || 'Kein Name' }} <div class="name-price">
<PpButton <span>{{ card.name || 'Kein Name' }}</span>
class="icon-button bg-main" <span>{{ intl.format(+replaceComma(card.price))}}</span>
@click="folded = !folded" </div>
> <div v-if="$device.isDesktop" class="flex-row gap-default">
<Icon :name="folded ? 'uil:sort' : 'uil:sorting'" mode="svg" /> <PpButton class="icon-button" @click="update()">
<Icon class="icon" name="uil:pen" mode="svg" />
</PpButton> </PpButton>
<PpButton class="icon-button" @click="deleteCard()">
<Icon class="icon" name="uil:trash-alt" mode="svg" />
</PpButton>
</div>
</header> </header>
<aside>
<div class="input-wrapper padding bg-blue flex-col"> <main class="wrapper">
<div class="wrapper">
<PpFormInput v-model="card.name" label="Name" id="n" :uid="card.uuid" type="text" @blur="update" />
<PpFormInput v-model="card.price" label="Preis" id="p" :uid="card.uuid" type="number" :min="0.01" @blur="calculate" />
</div>
<div class="wrapper">
<PpFormInput v-model="card.roles" label="Rollen" id="r" :uid="card.uuid" type="number" :max="150" @blur="calculate" />
<PpFormInput v-model="card.sheets" label="Blätter" id="b" :uid="card.uuid" type="number" :max="500" @blur="calculate" />
<PpFormInput v-model="card.layers" label="Lagen" id="l" :uid="card.uuid" type="number" :max="10" @blur="calculate" />
</div>
</div>
</aside>
<main class="wrapper padding bg-white">
<div class="info flex-col"> <div class="info flex-col">
<div class="price">
<Icon class="icon" name="uil:toilet-paper" mode="svg" /> <Icon class="icon" name="uil:toilet-paper" mode="svg" />
<span class="price">{{ intl.format(ppr) }}</span> <span class="value">{{ intl.format(card.ppr) }}</span>
<span class="pro">Pro 1</span> </div>
<span class="pro">Pro 1 {{ card.roles ? `(${card.roles})` : '' }}</span>
</div> </div>
<div class="info flex-col"> <div class="info flex-col">
<div class="price">
<Icon class="icon" name="uil:file-landscape" mode="svg" /> <Icon class="icon" name="uil:file-landscape" mode="svg" />
<span class="price">{{ intl.format(pps) }}</span> <span class="value">{{ intl.format(card.pps) }}</span>
<span class="pro">Pro 10</span> </div>
<span class="pro">Pro 100 {{ card.sheets ? `(${card.sheets})` : '' }}</span>
</div> </div>
<div class="info flex-col"> <div class="info flex-col">
<div class="price">
<Icon class="icon" name="uil:layer-group" mode="svg" /> <Icon class="icon" name="uil:layer-group" mode="svg" />
<span class="price">{{ intl.format(ppl) }}</span> <span class="value">{{ intl.format(card.ppl) }}</span>
<span class="pro">Pro 100</span> </div>
<span class="pro">Pro 100 {{ card.layers ? `(${card.layers})` : '' }}</span>
</div> </div>
</main> </main>
<footer class="padding bg-blue flex-row"> </div>
<PpButton </article>
class="delete"
:class="{ deletable }"
@click="deleteCard"
>
<Icon name="uil:trash" mode="svg" />
Entfernen
</PpButton>
<PpButton v-if="false" class="cta white">
<Icon name="uil:qrcode-scan" mode="svg" />
Scan
</PpButton>
</footer>
</form>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -72,44 +67,30 @@ type Props = {
const { card } = defineProps<Props>() const { card } = defineProps<Props>()
const emit = defineEmits(['remove', 'update']) const emit = defineEmits(['remove', 'update'])
const root = ref<HTMLElement>() const top = useTemplateRef('top')
const folded = ref<boolean>(false) const left = shallowRef<string>('0')
const deleting = ref<boolean>(false)
const ppr = ref(card.ppr)
const pps = ref(card.pps)
const ppl = ref(card.ppl)
const intl = Intl.NumberFormat('de-DE', { const intl = Intl.NumberFormat('de-DE', {
style: 'currency', style: 'currency',
currency: 'EUR', currency: 'EUR',
}) })
const calculate = () => { const { lengthX, isSwiping } = useSwipe(top, {
if (!card.price || !card.roles) return passive: false,
ppr.value = card.price / card.roles threshold: 30,
onSwipe() {
if (!card.sheets) { if (lengthX.value > 50 || lengthX.value < -50) {
update() left.value = `${-clamp(lengthX.value, -100, 100)}px`
return
} }
pps.value = (ppr.value / card.sheets) * 10 },
onSwipeEnd() {
if (lengthX.value < -50) update()
if (lengthX.value > 50) deleteCard()
left.value = '0'
},
})
if(!card.layers) { const update = () => emit('update')
update()
return
}
ppl.value = (pps.value / card.layers) * 10
update() const deleteCard = () => emit('remove')
}
const update = () => emit('update', { ...card, ppr: ppr.value, pps: pps.value, ppl: ppl.value })
const deleteCard = async () => {
root.value?.addEventListener('transitionend', () => emit('remove'))
deleting.value = true
}
onMounted(() => folded.value = !!card.price)
</script> </script>

View file

@ -0,0 +1,129 @@
<template>
<dialog
ref="dialog"
closedby="any"
>
<form method="dialog">
<header class="flex-row padding">
{{ cardLabel }}
<PpButton class="round text">
<Icon name="uil:times" mode="svg" />
</PpButton>
</header>
</form>
<main v-if="currentCard">
<div class="padding flex-col">
<div class="flex-row gap-default">
<PpFormInput
v-model="currentCard.name"
id="card_name"
label="Name"
:class="{'error': !validFields.name }"
:message="!validFields.name ? 'Feld darf nicht leer sein.' : ''"
/>
<PpFormInput
v-model="currentCard.price"
id="card_price"
label="Preis"
:class="{'error': !validFields.price }"
:message="!validFields.price ? 'Muss eine Zahl sein.' : ''"
/>
</div>
<div class="flex-row gap-default">
<PpFormInput
v-model="currentCard.roles"
id="card_roles"
label="Rollen"
:class="{'error': !validFields.roles }"
:message="!validFields.roles ? 'Muss eine Ganzzahl sein.' : ''"
/>
<PpFormInput
v-model="currentCard.sheets"
id="card_sheets"
label="Blätter"
:class="{'error': !validFields.sheets }"
:message="!validFields.sheets ? 'Muss eine Ganzzahl sein.' : ''"
/>
<PpFormInput
v-model="currentCard.layers"
id="card_layers"
label="Lagen"
:class="{'error': !validFields.layers }"
:message="!validFields.layers ? 'Muss eine Ganzzahl sein.' : ''"
/>
</div>
</div>
</main>
<footer class="flex-row padding">
<form method="dialog">
<PpButton class="danger text">
<span>Abbrechen</span>
</PpButton>
</form>
<PpButton class="raised" @click="validate">
<span>{{ cardLabel }}</span>
</PpButton>
</footer>
</dialog>
</template>
<script setup lang="ts">
import type { Card } from '../../../shared/Card'
type Props = {
currentCardIndex : number
currentCard ?: Card
}
const { currentCardIndex, currentCard } = defineProps<Props>()
const emit = defineEmits(['update'])
const dialog = useTemplateRef<HTMLDialogElement>('dialog')
const cardLabel = computed(() => currentCardIndex > -1 ? 'Bearbeiten' : 'Hinzufügen')
const checkPrice = () => {
if (!currentCard) { return false }
if (currentCard.price.length === 0) { return false }
const price = +replaceComma(currentCard.price)
return !isNaN(price)
}
const checkIfInteger = (toBeNumber : string) => {
if (toBeNumber.length === 0) { return false }
if (toBeNumber.includes(',') || toBeNumber.includes('.')) { return false }
return !isNaN(+toBeNumber)
}
const validFields = reactive({
name: true,
price: true,
roles: true,
sheets: true,
layers: true,
})
const validate = () => {
if (!currentCard) { return }
validFields.name = currentCard.name.length > 0
validFields.price = checkPrice()
validFields.roles = checkIfInteger(currentCard.roles)
validFields.sheets = checkIfInteger(currentCard.sheets)
validFields.layers = checkIfInteger(currentCard.layers)
if (Object.values(validFields).every(value => value)) {
emit('update')
dialog.value?.close()
}
}
onMounted(() => {
dialog.value?.addEventListener('close', () => {
validFields.name = true
validFields.price = true
validFields.roles = true
validFields.sheets = true
validFields.layers = true
})
})
</script>

72
app/pages/imprint.vue Normal file
View file

@ -0,0 +1,72 @@
<template>
<div>
<section class="Imp flex-col gap-default content full">
<div>
<p>
Fiona Lena Urban<br/>
Fiona Urban aka webfussel<br/>
Teich&auml;ckerweg 39<br/>
76297 Stutensee
</p>
</div>
<div>
<h3>Kontakt</h3>
<ClientOnly>
<p>
Telefon: 017631640961<br/>
E-Mail: fiona@webfussel.de
</p>
</ClientOnly>
</div>
<div>
<h3>Umsatzsteuer-ID</h3>
<p>
Umsatzsteuer-Identifikationsnummer gem&auml;&szlig; &sect; 27 a Umsatzsteuergesetz:<br/>
DE348500161
</p>
</div>
<div>
<h3>Angaben zur Berufs&shy;haftpflicht&shy;versicherung</h3>
<p>
<strong>Name und Sitz des Versicherers:</strong><br/>
Hiscox SA<br/>
Arnulfstr. 31<br/>
80636 M&uuml;nchen
</p>
<p>
<strong>Geltungsraum der Versicherung:</strong><br/>
Bundesrepublik Deutschland
</p>
</div>
<div>
<h3>Redaktionell verantwortlich</h3>
<p>Fiona Lena Urban</p>
</div>
<div>
<h3>Verbraucher&shy;streit&shy;beilegung / Universal&shy;schlichtungs&shy;stelle</h3>
<p>
Wir sind nicht bereit oder verpflichtet, an Streitbeilegungsverfahren vor einer
Verbraucherschlichtungsstelle teilzunehmen.
</p>
</div>
<div class="flex-col gap-default">
<h3>Quellenangaben</h3>
<div>
<h4>Impressumstext</h4>
<p>Quelle: <a href="https://www.e-recht24.de">e-recht24.de</a></p>
</div>
</div>
</section>
</div>
</template>
<script setup lang="ts">
useSeoMeta({
robots: 'noindex, nofollow',
})
</script>

View file

@ -1,4 +1,15 @@
<template> <template>
<PpDeleteDialog
ref="deleteModal"
:current-card-index="currentCardIndex"
@delete="removeCard(currentCardIndex)"
/>
<PpPriceCardDialog
ref="modal"
:current-card="currentCard"
:current-card-index="currentCardIndex"
@update="updateCard()"
/>
<section class="content flex-col"> <section class="content flex-col">
<aside class="filter-bar"> <aside class="filter-bar">
<PpButtonGroup <PpButtonGroup
@ -12,13 +23,13 @@
:key="card.uuid" :key="card.uuid"
:deletable="cards.length > 1" :deletable="cards.length > 1"
:card="card" :card="card"
@update="newCard => updateCard(newCard, index)" @update="openModal(false, index)"
@remove="removeCard(card)" @remove="openDeleteModal()"
/> />
</div> </div>
</section> </section>
<PpToolbar> <PpToolbar>
<PpButton class="mini-button text-white" @click="sort(currentSort)"> <PpButton class="mini-button text-white transparent" @click="sort(currentSort)">
<Icon class="icon" name="uil:refresh" mode="svg" /> <Icon class="icon" name="uil:refresh" mode="svg" />
<span>Neu sortieren</span> <span>Neu sortieren</span>
<span <span
@ -27,7 +38,7 @@
aria-hidden="true" aria-hidden="true"
/> />
</PpButton> </PpButton>
<PpButton class="mini-button text-white" @click="addCard"> <PpButton class="mini-button text-white transparent" @click="openModal(true, -1)">
<Icon class="icon" name="uil:plus" mode="svg" /> <Icon class="icon" name="uil:plus" mode="svg" />
<span>Hinzufügen</span> <span>Hinzufügen</span>
</PpButton> </PpButton>
@ -37,46 +48,82 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Card } from '../../shared/Card' import type { Card } from '../../shared/Card'
import type { Button } from '../../shared/ButtonGroup' import type { Button } from '../../shared/ButtonGroup'
import { PpPriceCardDialog, PpDeleteDialog } from '#components'
const currentSort = ref(0) const currentSort = ref(0)
const isDirty = ref(false) const isDirty = ref(false)
const currentCard = ref<Card>()
const currentCardIndex = ref<number>(-1)
const modal = useTemplateRef<typeof PpPriceCardDialog>('modal')
const deleteModal = useTemplateRef<typeof PpDeleteDialog>('deleteModal')
const createCard = (uuid : string) : Card => ({ const createCard = (uuid : string) : Card => ({
uuid, uuid,
name: '', name: '',
price: 0, price: '',
roles: 0, roles: '',
sheets: 0, sheets: '',
layers: 0, layers: '',
ppr: 0, ppr: 0,
pps: 0, pps: 0,
ppl: 0, ppl: 0,
}) })
const cards = useState('cards', () => [ const cards = useState<Card[]>('cards', () => [
createCard(crypto.randomUUID()), createCard(crypto.randomUUID()),
]) ])
const addCard = () => { const addCard = (card : Card) => {
cards.value.unshift(createCard(crypto.randomUUID())) const price = calculate(card)
isDirty.value = true cards.value.unshift({ ...card, ...price })
}
const removeCard = (card : Card) => {
cards.value = cards.value.filter(element => element.uuid !== card.uuid)
isDirty.value = true isDirty.value = true
updateLocalStorage() updateLocalStorage()
} }
const updateCard = (card : Card, index : number) => { const removeCard = (index : number) => {
cards.value[index] = card cards.value.splice(index, 1)
isDirty.value = true isDirty.value = true
updateLocalStorage() updateLocalStorage()
} }
const updateCard = () => {
if (currentCardIndex.value === -1) {
addCard(currentCard.value!)
return
}
const price = calculate(currentCard.value!)
const newCard = { ...currentCard.value!, ...price }
cards.value.splice(currentCardIndex.value, 1, newCard)
isDirty.value = true
updateLocalStorage()
}
const openModal = (createNew : boolean, index : number) => {
if (createNew) {
currentCardIndex.value = -1
currentCard.value = createCard(crypto.randomUUID())
modal.value?.$el.showModal()
return
}
currentCardIndex.value = index
currentCard.value = { ...cards.value[index]! }
modal.value?.$el.showModal()
return
}
const openDeleteModal = () => {
deleteModal.value?.$el.showModal()
}
const updateLocalStorage = () => { const updateLocalStorage = () => {
localStorage.setItem('cards', JSON.stringify(cards.value)) localStorage.setItem('cards', JSON.stringify(cards.value.map(card => {
const { uuid, name, price, roles, sheets, layers } = card
return { uuid, name, price, roles, sheets, layers }
})))
localStorage.setItem('sort', JSON.stringify(currentSort.value)) localStorage.setItem('sort', JSON.stringify(currentSort.value))
} }
@ -120,8 +167,16 @@ const sort = (index : number) => {
isDirty.value = false isDirty.value = false
} }
const calculate = (card : Card) => {
const ppr = +replaceComma(card.price) / +card.roles
const pps = (ppr / +card.sheets) * 100
const ppl = (pps / +card.layers)
return { ppr, pps, ppl }
}
onMounted(() => { onMounted(() => {
const cardsFromStorage = JSON.parse(localStorage.getItem('cards') ?? '[]') const cardsFromStorage = JSON.parse(localStorage.getItem('cards') ?? '[]').map((card : Card) => ({ ...card, ...calculate(card) }))
cards.value = cardsFromStorage.length !== 0 ? cardsFromStorage : cards.value cards.value = cardsFromStorage.length !== 0 ? cardsFromStorage : cards.value
const sortFromStorage = +JSON.parse(localStorage.getItem('sort') ?? '0') const sortFromStorage = +JSON.parse(localStorage.getItem('sort') ?? '0')
sort(sortFromStorage) sort(sortFromStorage)

81
app/pages/overview.vue Executable file
View file

@ -0,0 +1,81 @@
<template>
<section class="content flex-col">
<aside class="filter-bar">
<PpButtonGroup
:buttons="filterButtons"
@click="sort"
/>
</aside>
<div class="pc-wrapper flex-col" role="list">
<p
v-for="product in products"
:key="product.sku"
>
{{ product.name }} - {{ product.price }}
</p>
</div>
</section>
</template>
<script setup lang="ts">
import type { Card } from '../../shared/Card'
import type { Button } from '../../shared/ButtonGroup'
import type { Product } from '../../shared/db/Product'
const currentSort = ref(0)
const createCard = (uuid : string) : Card => ({
uuid,
name: '',
price: 0,
roles: 0,
sheets: 0,
layers: 0,
ppr: 0,
pps: 0,
ppl: 0,
})
const { data : products } = useFetch<Product[]>('/api/products')
const cards = useState('cards', () => [
createCard(crypto.randomUUID()),
])
const filterButtons = ref<Button[]>([
{
label: 'Rollen',
icon: 'uil:toilet-paper',
},
{
label: 'Blatt',
icon: 'uil:file-landscape',
},
{
label: 'Lagen',
icon: 'uil:layer-group',
},
])
const sortBy = (key : 'ppr' | 'pps' | 'ppl') => {
cards.value.sort((a : Card, b : Card) => a[key] - b[key])
}
const sort = (index : number) => {
currentSort.value = index
filterButtons.value.forEach(button => { button.active = false })
filterButtons.value[index]!.active = true
switch (index) {
case 0:
sortBy('ppr')
break
case 1:
sortBy('pps')
break
case 2:
sortBy('ppl')
break
}
}
</script>

19
app/pages/privacy.vue Normal file
View file

@ -0,0 +1,19 @@
<template>
<section class="flex-col gap-default content full">
<h3>
Datenschutzerklärung
</h3>
<p>
Wir senden keinerlei Daten an Drittanbieter.
</p>
<p>
Wir verwerten keinerlei Daten.
</p>
<p>
Alle persistierten Daten befinden sich ausschließlich auf Ihrem Endgerät im sogenannten "localStorage" und werden ausschließlich auf Ihrem Gerät verarbeitet.
</p>
</section>
</template>
<style>
</style>

3
app/utils/number.ts Normal file
View file

@ -0,0 +1,3 @@
export const replaceComma = (value: string | number) => `${value}`.replace(',', '.')
export const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max)

View file

@ -6,8 +6,27 @@ export default defineNuxtConfig({
compatibilityVersion: 4, compatibilityVersion: 4,
}, },
nitro: {
prerender: {
routes: [
'/',
'/imprint',
'/privacy',
]
}
},
routeRules: {
'/': { prerender: true },
'/imprint': { prerender: true },
'/privacy': { prerender: true },
},
modules: [ modules: [
'@nuxt/icon', '@nuxt/icon',
'@vueuse/nuxt',
'@nuxtjs/device',
'nuxt-mongoose',
], ],
css : [ css : [
@ -19,5 +38,12 @@ export default defineNuxtConfig({
'./app/assets/styles/priceCard.css', './app/assets/styles/priceCard.css',
'./app/assets/styles/formInput.css', './app/assets/styles/formInput.css',
'./app/assets/styles/toolbar.css', './app/assets/styles/toolbar.css',
] ],
mongoose: {
uri: `${process.env.MONGODB_URI}`,
modelsDir: 'models',
devtools: true,
},
}) })

11770
package-lock.json generated Executable file → Normal file

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"prepare": "nuxt prepare",
"build": "nuxt build", "build": "nuxt build",
"dev": "nuxt dev", "dev": "nuxt dev",
"dev:expose": "nuxt dev --host", "dev:expose": "nuxt dev --host",
@ -11,8 +12,13 @@
"postinstall": "nuxt prepare" "postinstall": "nuxt prepare"
}, },
"dependencies": { "dependencies": {
"@iconify-json/simple-icons": "^1.2.32",
"@iconify-json/uil": "^1.2.3",
"@nuxt/icon": "^1.10.3", "@nuxt/icon": "^1.10.3",
"nuxt": "^3.15.4", "@nuxtjs/device": "^3.2.4",
"@vueuse/nuxt": "^13.1.0",
"nuxt": "^3.16.2",
"nuxt-mongoose": "^1.0.6",
"vue": "latest", "vue": "latest",
"vue-router": "latest" "vue-router": "latest"
} }

View file

@ -0,0 +1,9 @@
export default defineEventHandler(async () => {
try {
return await ProductSchema.find()
} catch (error) {
console.error(error)
return []
}
})

View file

@ -0,0 +1,49 @@
import { defineMongooseModel } from '#nuxt/mongoose'
export const ProductSchema = defineMongooseModel({
name: 'products',
schema: {
name: {
type: String,
required: true,
},
brand: {
type: String,
required: true,
},
image: {
type: String,
required: true,
unique: true,
},
market: {
type: String,
required: true,
},
category: {
type: String,
required: true,
},
sku: {
type: String,
required: true,
unique: true,
},
price: {
type: Number,
required: true,
},
pieces: {
type: Number,
required: true,
},
sheets: {
type: Number,
required: true,
},
layers: {
type: Number,
required: true,
},
}
})

View file

@ -1,11 +1,11 @@
export type Card = { export type Card = {
uuid: string
name: string
price: number
roles: number
sheets: number
layers: number
ppr: number ppr: number
pps: number pps: number
ppl: number ppl: number
uuid: string
name: string
price: string
roles: string
sheets: string
layers: string
} }

12
shared/db/Product.ts Normal file
View file

@ -0,0 +1,12 @@
export type Product = {
name: string
brand: string
image: string
market: string
category: string
sku: string
price: number
pieces: number
sheets: number
layers: number
}