Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
susickypavel committed Oct 4, 2024
1 parent 704ee7e commit c1a7454
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 69 deletions.
95 changes: 32 additions & 63 deletions apps/api/public/openapi.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,91 @@
openapi: 3.1.0
info:
title: Frontendista.cz API
description: Awesome API 😎
title: Frontendista.cz
description: API for frontendista.cz
version: 1.0.0
contact:
name: Pavel Sušický
email: [email protected]
url: https://frontendista.cz

servers:
- url: https://frontendista.cz/api
- url: https://cloudflare.frontendista.cz
description: Production
- url: https://staging.frontendista.cz/api
- url: https://cloudflare-staging.frontendista.workers.dev
description: Staging
- url: http://localhost:3000/api
- url: http://localhost:3003
description: Development
- url: http://localhost:3001/api
description: Preview

tags:
- name: "Contact"
description: "Operations related to contact form"

components:
responses:
MessageError:
description: Error
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error message
MessageSent:
description: Message sent
content:
application/json:
schema:
type: object
properties:
total_messages_count:
type: integer
description: Total number of messages sent
example: 54
schema:
type: string
format: binary

schemas:
Message:
type: object
properties:
name:
firstname:
type: string
description: Name of the sender
description: First name of the sender
example: Pavel
minLength: 2
maxLength: 50

lastname:
type: string
description: Last name of the sender
example: Sušický
minLength: 2
maxLength: 50

email:
type: string
format: email
description: Email of the sender
example: [email protected]

message:
type: string
description: Message of the sender
example: Hello, World!
minLength: 3
maxLength: 1024
minLength: 10
maxLength: 250

required:
- message

paths:
/message:
post:
operationId: sendMessage
description: Sends message to Discord channel, it uses rate-limiting to prevent spam
summary: Send Discord message
operationId: send_message
description: Sends message to personal email
summary: Send message
tags:
- Contact
parameters:
- in: query
name: js
schema:
type: string
enum:
- false
description: Whether client has scripting enabled.
allowEmptyValue: true
requestBody:
required: true
content:
application/x-www-form-urlencoded:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/Message"

responses:
"201":
$ref: "#/components/responses/MessageSent"
"302":
description: "Successful page if scripting is disabled"
headers:
Location:
schema:
type: string
description: Redirect URL
example: /contact/success
"303":
description: "Error page if scripting is disabled"
headers:
Location:
schema:
type: string
description: Redirect URL
example: /contact/error
description: "Message sent"

"400":
$ref: "#/components/responses/MessageError"
description: "Malformed or invalid request body"

"429":
description: "Too many requests"
"503":
$ref: "#/components/responses/MessageError"
description: "Discord API is unavailable"

2 changes: 1 addition & 1 deletion apps/cloudflare
2 changes: 1 addition & 1 deletion apps/web/src/components/common/heading.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Props {
const { as: Element = "h1", href, class: className, ...attrs } = Astro.props;
---

<Element class="inline-flex items-center gap-[0.1em]" class:list={["w-full", className]} {...attrs}>
<Element class="inline-flex gap-[0.1em]" class:list={["w-full", className]} {...attrs}>
<slot />
{href ? (
<a class="after:content-['#'] text-secondary" href={href}>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/layouts/base-layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const {
<a class="w-[calc(100%-theme(padding.xl))] -translate-x-1/2 -translate-y-1/2 offscreen focus-visible:left-1/2 focus-visible:top-1/2 sm:w-auto lg:w-auto" data-btn="primary" href="#main">Skip to content</a>
<SpritesheetCommon />
<slot name="body_start" />
<main class={classNames.main} id="main">
<main class:list={["pt-[5rem] lg:pb-[5rem]", classNames.main]} id="main">
<slot />
</main>
<Footer />
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/_index/hero-section.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Icon from "~/components/common/icon.astro";
---

<header class="relative">
<div class="mx-auto min-h-[50vh] max-w-content flex-col gap-lg px-lg py-[6rem] center lg:gap-xl lg:px-2xl">
<div class="mx-auto min-h-[50vh] max-w-content flex-col gap-lg px-lg py-[6rem] center lg:gap-xl lg:px-2xl mb-[5rem]">
<h1 class="sr-only">Pavel Sušický, Front-end developer</h1>
<Icon class="w-full" viewBox="0 0 120 10" title="Hello 👋, I'm Pavel.">
<path d="M3.062 6.242v2.872H0v-8.9h8.236v2.551H3.062v.926h4.936v2.551H3.062Zm9.387-.095v2.967H9.387v-8.9h5.577c.712 0 1.335.124 1.869.373.534.25.95.596 1.247 1.039.296.443.445.965.445 1.566 0 .586-.149 1.102-.445 1.549-.297.447-.713.793-1.247 1.038-.08.037-.162.071-.246.102l2.294 3.233H15.38l-2.02-2.967h-.911Zm0-2.124h2.041c.3 0 .534-.071.7-.214.166-.142.249-.348.249-.617s-.083-.474-.249-.617c-.166-.142-.4-.213-.7-.213h-2.041v1.661Zm12.306 5.305c-1.084 0-2.032-.194-2.842-.582-.811-.388-1.442-.932-1.893-1.632-.451-.7-.677-1.517-.677-2.45 0-.934.226-1.751.677-2.451.451-.7 1.082-1.244 1.893-1.632C22.723.194 23.671 0 24.755 0s2.031.194 2.842.581c.811.388 1.442.932 1.893 1.632.451.7.676 1.517.676 2.451 0 .933-.225 1.75-.676 2.45-.451.7-1.082 1.244-1.893 1.632-.811.388-1.758.582-2.842.582Zm0-2.73c.482 0 .898-.077 1.246-.231.348-.155.615-.376.801-.665.186-.289.279-.635.279-1.038 0-.404-.093-.75-.279-1.039-.186-.288-.453-.51-.801-.664-.348-.154-.764-.232-1.246-.232-.483 0-.898.078-1.246.232-.348.154-.615.376-.801.664-.186.289-.279.635-.279 1.039 0 .403.093.749.279 1.038.186.289.453.51.801.665.348.154.763.231 1.246.231Zm9.47-3.053v5.569h-2.967v-8.9h3.952l3.465 5.379V.214h2.967v8.9h-3.833l-3.584-5.569Zm11.582-.602h-3.204V.214h9.47v2.729h-3.204v6.171h-3.062V2.943Zm10.227 3.75h5.378v2.421h-8.615l.652-4.45-.652-4.45h8.556v2.42h-5.319l.161.974h4.778V5.72h-4.778l-.161.973Zm9.603-3.148v5.569H62.67v-8.9h3.952l3.465 5.379V.214h2.967v8.9h-3.833l-3.584-5.569ZM79.201.214c1.084 0 2.031.184 2.842.551.811.368 1.442.885 1.893 1.549.451.665.676 1.448.676 2.35 0 .894-.225 1.675-.676 2.344-.451.668-1.082 1.186-1.893 1.554-.811.368-1.758.552-2.842.552h-4.723v-8.9h4.723Zm-1.685 2.729v3.441h1.922c.435 0 .809-.069 1.122-.207.312-.139.552-.336.718-.594.166-.257.249-.563.249-.919 0-.364-.083-.673-.249-.926-.166-.253-.406-.449-.718-.587-.313-.139-.687-.208-1.122-.208h-1.922ZM85.704.214h3.062v8.9h-3.062v-8.9Zm4.189 5.969h3.109c.032.174.123.322.273.445.151.122.356.217.617.285.261.067.574.1.938.1.475 0 .844-.047 1.109-.142.266-.095.398-.249.398-.463 0-.142-.075-.263-.225-.362-.151-.099-.459-.164-.926-.196l-1.472-.094c-1.337-.087-2.302-.372-2.895-.855-.594-.482-.89-1.119-.89-1.91 0-.665.19-1.219.569-1.662.38-.443.912-.775 1.597-.997C92.779.111 93.58 0 94.498 0c.894 0 1.687.125 2.379.374s1.242.599 1.65 1.05c.407.451.63.977.67 1.578h-3.109c-.024-.142-.101-.265-.232-.368-.13-.102-.314-.181-.551-.237-.238-.055-.527-.083-.867-.083-.435 0-.777.044-1.026.131-.249.087-.374.229-.374.427 0 .134.073.249.22.344.146.095.429.158.848.19l1.661.107c.871.055 1.575.184 2.113.385.538.202.931.481 1.181.837.249.356.373.795.373 1.317 0 .657-.193 1.23-.581 1.721-.388.49-.932.872-1.632 1.145-.7.273-1.517.41-2.45.41-.966 0-1.812-.131-2.54-.392s-1.295-.629-1.703-1.104c-.407-.474-.619-1.024-.635-1.649Zm13.078-3.24h-3.204V.214h9.47v2.729h-3.205v6.171h-3.061V2.943Zm9.011 4.676-.609 1.495h-3.264l3.904-8.9h4.083l3.904 8.9h-3.263l-.609-1.495h-4.146Zm3.155-2.433-1.082-2.658-1.083 2.658h2.165Z"/>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/privacy.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const generatedAt = new Date("2024-09-01");
default: "Pavel Sušický - Privacy Policy"
}}
classNames={{
main: "mx-auto flex max-w-content flex-col gap-xl px-lg mt-[5rem] lg:px-2xl [&_p]:max-w-[80ch] counter-section"
main: "mx-auto flex max-w-content flex-col gap-xl px-lg lg:px-2xl [&_p]:max-w-[80ch] counter-section"
}}>
<header>
<Heading class="mb-xl">Privacy Policy</Heading>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/verify.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import VerifySpritesheet from "~/assets/svg/spritesheet/verify.astro";
default: "Pavel Sušický - Card verification"
}}
classNames={{
main: "lg:grid grid-cols-2 pt-[5rem] max-w-content mx-auto px-lg lg:px-2xl items-center gap-2xl"
main: "lg:grid grid-cols-2 max-w-content mx-auto px-lg lg:px-2xl items-center gap-2xl min-h-view"
}}>
<VerifySpritesheet slot="body_start" />
<header class="flex flex-col justify-center gap-lg">
Expand Down

0 comments on commit c1a7454

Please sign in to comment.