First UI implementation
All checks were successful
/ checking (push) Successful in 12s
/ check-tag (push) Successful in 2s
/ build-site (push) Successful in 59s
/ create-release (push) Successful in 1h11m3s

This commit is contained in:
Firq 2024-10-03 21:56:37 +02:00
parent dfb409db9e
commit 039a64e116
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
20 changed files with 2412 additions and 291 deletions

View file

@ -0,0 +1,65 @@
on:
push:
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
jobs:
check-tag:
runs-on: docker
steps:
- name: Checking Out Repository Code
uses: https://code.forgejo.org/actions/checkout@v3
- name: Check if Version in package.json matches Tag
run: |
VERSION=$(npm pkg get version --workspaces=false | tr -d \")
if test $VERSION != "${{ github.ref_name }}"; then
echo "Expected Version is: '${{ github.ref_name }}' actual Version is: '$VERSION'";
exit 1
else
echo "Version is: '$VERSION'";
fi
checking:
needs: [ check-tag ]
runs-on: docker
container: forgejo.neshweb.net/ci-docker-images/node-alpine-git:latest
steps:
- name: Checkout source code
uses: https://code.forgejo.org/actions/checkout@v3
- name: Install packages
run: npm i
- name: Run astro check (linting + static analysis)
run: npm run astro check
build-site:
needs: [ checking ]
if: success()
runs-on: dind
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into Docker Package Registry
uses: docker/login-action@v3
with:
registry: forgejo.neshweb.net
username: ${{ secrets.FORGEJO_USERNAME }}
password: ${{ secrets.FORGEJO_TOKEN }}
- name: Build and push to Docker Package Registry
uses: docker/build-push-action@v5
with:
push: true
tags: forgejo.neshweb.net/firq/support-formatter-ui:${{ github.ref_name }}
create-release:
needs: [ build-site ]
if: success()
runs-on: docker
steps:
- name: Release New Version
uses: https://code.forgejo.org/actions/forgejo-release@v1
with:
direction: upload
url: https://forgejo.neshweb.net
release-dir: release
token: ${{ secrets.FORGEJO_TOKEN }}
tag: ${{ github.ref_name }}

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM node:22-alpine AS build
WORKDIR /site
COPY . .
RUN npm i
RUN npm run astro telemetry disable
RUN npm run build
FROM forgejo.neshweb.net/ci-docker-images/website-serve:2 AS runtime
COPY --from=build /site/dist /public
COPY --from=build /site/serve.json /public/serve.json
ENV PORT=8081
EXPOSE 8081
CMD serve public/ -p ${PORT}

View file

@ -1,54 +1,3 @@
# Astro Starter Kit: Basics
# support-formatter-ui
```sh
npm create astro@latest -- --template basics
```
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)
## 🚀 Project Structure
Inside of your Astro project, you'll see the following folders and files:
```text
/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
```
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the `public/` directory.
## 🧞 Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |
## 👀 Want to learn more?
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
UI for support-formatter

View file

@ -1,5 +1,13 @@
// @ts-check
import sitemap from '@astrojs/sitemap';
import metaTags from "astro-meta-tags";
import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({});
export default defineConfig({
sitemap: true,
base: '/',
outDir: 'dist',
publicDir: 'public',
site: 'https://support-formatter.firq.dev/',
integrations: [sitemap(), metaTags()],
trailingSlash: "never"
});

1890
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{
"name": "",
"name": "support-formatter-ui",
"type": "module",
"version": "0.0.1",
"version": "0.1.0",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
@ -10,8 +10,13 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.15.11",
"@astrojs/check": "^0.9.3",
"@astrojs/sitemap": "^3.2.0",
"@fontsource/work-sans": "^5.1.0",
"astro": "^4.15.11",
"astro-meta-tags": "^0.3.1",
"autoprefixer": "^10.4.19",
"postcss-preset-env": "^9.6.0",
"typescript": "^5.6.2"
}
}

13
postcss.config.cjs Normal file
View file

@ -0,0 +1,13 @@
module.exports = {
plugins: {
"postcss-preset-env": {
autoprefixer: { flexbox: "no-2009" },
stage: 2,
features: {
"custom-properties": false,
"custom-media-queries": true,
"nesting-rules": true
}
}
}
};

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

View file

@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
<style>
path { fill: #000; }
@media (prefers-color-scheme: dark) {
path { fill: #FFF; }
}
</style>
</svg>

Before

Width:  |  Height:  |  Size: 749 B

7
public/robots.txt Normal file
View file

@ -0,0 +1,7 @@
user-agent:*
Disallow: /assets/data/
User-agent: GPTBot
Disallow: /
Sitemap: https://fgo-ta.com/sitemap-index.xml

34
serve.json Normal file
View file

@ -0,0 +1,34 @@
{
"cleanUrls": true,
"directoryListing": false,
"etag": true,
"headers": [
{
"source": "**/*.@(jpg|jpeg|gif|png|webp|svg)",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
},
{
"source": "**/*.woff2",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
},
{
"source": "404.html",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
]
}

BIN
src/assets/embed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

View file

@ -1,61 +0,0 @@
---
interface Props {
title: string;
body: string;
href: string;
}
const { href, title, body } = Astro.props;
---
<li class="link-card">
<a href={href}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
{body}
</p>
</a>
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 1px;
background-color: #23262d;
background-image: none;
background-size: 400%;
border-radius: 7px;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.link-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: calc(1.5rem - 1px);
border-radius: 8px;
color: white;
background-color: #23262d;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
background-image: var(--accent-gradient);
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent-light));
}
</style>

74
src/components/form.astro Normal file
View file

@ -0,0 +1,74 @@
---
import '@fontsource/work-sans/400.css'
import Textfield from "./formfields/textfield.astro";
import Fileupload from "./formfields/fileupload.astro";
const apiurl = "https://support-formatter-api.firq.dev/upload"
---
<div>
<form
method="post"
enctype="multipart/form-data"
action={apiurl}
>
<Textfield
id="f_username"
name="username"
text="Username"
placeholder="Your Username"
required={true}
/>
<br />
<Textfield
id="f_friendcode"
name="friendcode"
text="Friendcode"
placeholder="000,000,000"
required={false}
/>
<br />
<Fileupload id="f_servantdata" name="servantdata" text="Servantdata" />
<br />
<Fileupload id="f_cedata" name="cedata" text="CE Data (optional)" />
<br />
<input type="submit" value="Upload" />
</form>
</div>
<style>
div {
display: flex;
border: 5px solid var(--c-darkpurple);
padding: 0.5rem 2rem;
border-radius: 2rem;
margin-top: 1rem;
}
form {
display: flex;
flex-flow: column;
align-items: center;
width: 100%;
}
input {
width: 75%;
height: 3rem;
border: 2px solid var(--c-darkpurple);
border-radius: 1rem;
background-color: var(--c-darkgray);
color: var(--c-darkpurple);
font-weight: bold;
font-size: 1.25rem;
text-transform: uppercase;
font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial, sans-serif;
}
input:hover {
border-color: var(--c-reddish);
color: var(--c-reddish);
transform: scale(1.025);
}
</style>

View file

@ -0,0 +1,54 @@
---
import '@fontsource/work-sans/400.css'
interface Props {
text: string;
id: string;
name: string;
}
const { id, text, name } = Astro.props;
---
<div>
<label for={id}>{text}</label>
<div class="inputwrapper">
<input type="file" id={id} name={name} />
</div>
</div>
<style>
label {
color: white;
font-size: 1.25rem;
margin-bottom: 0.5rem;
font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial, sans-serif;
}
.inputwrapper {
height: 2rem;
background-color: var(--c-darkgray);
border: 2px solid var(--c-darkpurple);
border-radius: 0.5rem;
color: white;
width: 100%;
padding: 0.25rem;
}
input::placeholder {
color: white;
}
.inputwrapper:focus-within {
outline: none !important;
border: 2px solid var(--c-reddish);
}
div {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-flow: column;
}
</style>

View file

@ -0,0 +1,54 @@
---
import '@fontsource/work-sans/400.css'
interface Props {
text: string;
id: string;
name: string;
placeholder: string;
required: boolean;
}
const { id, text, placeholder, name, required } = Astro.props;
---
<div>
<label for={id}>{text}</label>
<input type="text" id={id} name={name} placeholder={placeholder} required={required}/>
</div>
<style>
label {
color: white;
font-size: 1.25rem;
margin-bottom: 0.5rem;
font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial, sans-serif;
}
input {
height: 2rem;
background-color: var(--c-darkgray);
border: 2px solid var(--c-darkpurple);
border-radius: 0.5rem;
color: white;
width: 100%;
padding: 0.25rem;
}
input::placeholder {
color: white;
}
input:focus-within {
outline: none !important;
border: 2px solid var(--c-reddish);
}
div {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-flow: column;
}
</style>

View file

@ -0,0 +1,75 @@
---
import '@fontsource/work-sans/800.css'
---
<div class="wrap">
<div class="head"><span class="fancy">Support-Formatter</span></div>
<div class="sub">Convert .csv to Nerone-compatible data</div>
<div class="fade"></div>
</div>
<style>
.wrap {
position: relative;
width: 100%;
display: flex;
text-align: center;
align-items: center;
flex-wrap: wrap;
flex-direction: column;
color: var(--c-lighter);
background-color: var(--c-darkergray);
}
.fade {
margin-top: 1.5rem;
background: linear-gradient(to bottom, transparent, var(--c-lightgray));
height: 2.5rem;
width: 100%;
}
.head {
padding-top: 2rem;
font-size: 3rem;
font-weight: 800;
font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial,
sans-serif;
}
.sub {
font-size: 1rem;
font-weight: 800;
font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Helvetica, Arial,
sans-serif;
}
.fancy {
color: var(--c-darkpurple);
}
@supports (background-clip: text) {
.fancy {
background: linear-gradient(125deg, var(--c-darkpurple), var(--c-purplepink), var(--c-reddish) );
background-clip: text;
color: transparent;
}
}
@media (min-width: 620px) {
.head {
font-size: 4rem;
}
.sub {
font-size: 1.25rem;
}
}
@media (min-width: 1000px) {
.head {
font-size: 5rem;
}
.sub {
font-size: 1.5rem;
}
}
</style>

View file

@ -0,0 +1,27 @@
---
const apiversion = "http://localhost:5000/version";
const response = await fetch(apiversion);
const version = (await response.json())["version"];
---
<div>
Support Formatter API Version: <span>{version}</span>
</div>
<style>
span {
color: var(--c-darkpurple);
}
span::before {
content: " ";
white-space: pre;
}
div {
color: white;
display: flex;
margin-top: 1rem;
font-size: 1.25rem;
font-weight: bold;
}
</style>

View file

@ -1,50 +1,48 @@
---
import workSans400 from "@fontsource/work-sans/files/work-sans-latin-400-normal.woff2?url";
import embed from '../assets/embed.png'
interface Props {
title: string;
}
const currPage = 'https://support-formatter.firq.dev/'
const description = "Support Formatter - Convert csv files to Nerone-compatible data"
const { title } = Astro.props;
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Astro description" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
<!-- Meta Tags -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:url" content={currPage} />
<meta property="og:description" content={description} />
<meta property="og:image" content={embed.src} />
<meta property="og:type" content="website" />
<meta property="og:locale" content="en_US" />
<meta name="theme-color" content="#b86cff" />
<!-- Disable DarkReader, as site is already in dark mode -->
<meta name="darkreader-lock" content="this site only has darkmode" />
<!-- Links -->
<link
rel="preload"
as="font"
type="font/woff2"
href={workSans400}
crossorigin="anonymous"
/>
<link rel="icon" type="image/ico" href="/favicon.ico" />
<link rel="sitemap" href="/sitemap-index.xml" />
<link href="https://mastodon.neshweb.net/@Firq" rel="me" />
</head>
<body>
<slot />
</body>
</html>
<style is:global>
:root {
--accent: 136, 58, 234;
--accent-light: 224, 204, 250;
--accent-dark: 49, 10, 101;
--accent-gradient: linear-gradient(
45deg,
rgb(var(--accent)),
rgb(var(--accent-light)) 30%,
white 60%
);
}
html {
font-family: system-ui, sans-serif;
background: #13151a;
}
code {
font-family:
Menlo,
Monaco,
Lucida Console,
Liberation Mono,
DejaVu Sans Mono,
Bitstream Vera Sans Mono,
Courier New,
monospace;
}
</style>

View file

@ -1,123 +1,55 @@
---
import Layout from '../layouts/Layout.astro';
import Card from '../components/Card.astro';
import Layout from "../layouts/Layout.astro";
import Form from "../components/form.astro";
import Title from "../components/title.astro";
---
<Layout title="Welcome to Astro.">
<main>
<svg
class="astro-a"
width="495"
height="623"
viewBox="0 0 495 623"
fill="none"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M167.19 364.254C83.4786 364.254 0 404.819 0 404.819C0 404.819 141.781 19.4876 142.087 18.7291C146.434 7.33701 153.027 0 162.289 0H332.441C341.703 0 348.574 7.33701 352.643 18.7291C352.92 19.5022 494.716 404.819 494.716 404.819C494.716 404.819 426.67 364.254 327.525 364.254L264.41 169.408C262.047 159.985 255.147 153.581 247.358 153.581C239.569 153.581 232.669 159.985 230.306 169.408L167.19 364.254ZM160.869 530.172C160.877 530.18 160.885 530.187 160.894 530.195L160.867 530.181C160.868 530.178 160.868 530.175 160.869 530.172ZM136.218 411.348C124.476 450.467 132.698 504.458 160.869 530.172C160.997 529.696 161.125 529.242 161.248 528.804C161.502 527.907 161.737 527.073 161.917 526.233C165.446 509.895 178.754 499.52 195.577 500.01C211.969 500.487 220.67 508.765 223.202 527.254C224.141 534.12 224.23 541.131 224.319 548.105C224.328 548.834 224.337 549.563 224.347 550.291C224.563 566.098 228.657 580.707 237.264 593.914C245.413 606.426 256.108 615.943 270.749 622.478C270.593 621.952 270.463 621.508 270.35 621.126C270.045 620.086 269.872 619.499 269.685 618.911C258.909 585.935 266.668 563.266 295.344 543.933C298.254 541.971 301.187 540.041 304.12 538.112C310.591 533.854 317.059 529.599 323.279 525.007C345.88 508.329 360.09 486.327 363.431 457.844C364.805 446.148 363.781 434.657 359.848 423.275C358.176 424.287 356.587 425.295 355.042 426.275C351.744 428.366 348.647 430.33 345.382 431.934C303.466 452.507 259.152 455.053 214.03 448.245C184.802 443.834 156.584 436.019 136.218 411.348Z"
fill="url(#paint0_linear_1805_24383)"></path>
<defs>
<linearGradient
id="paint0_linear_1805_24383"
x1="247.358"
y1="0"
x2="247.358"
y2="622.479"
gradientUnits="userSpaceOnUse"
>
<stop stop-opacity="0.9"></stop>
<stop offset="1" stop-opacity="0.2"></stop>
</linearGradient>
</defs>
</svg>
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
<p class="instructions">
To get started, open the directory <code>src/pages</code> in your project.<br />
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
</p>
<ul role="list" class="link-card-grid">
<Card
href="https://docs.astro.build/"
title="Documentation"
body="Learn how Astro works and explore the official API docs."
/>
<Card
href="https://astro.build/integrations/"
title="Integrations"
body="Supercharge your project with new frameworks and libraries."
/>
<Card
href="https://astro.build/themes/"
title="Themes"
body="Explore a galaxy of community-built starter themes."
/>
<Card
href="https://astro.build/chat/"
title="Community"
body="Come say hi to our amazing Discord community. ❤️"
/>
</ul>
</main>
<Layout title="Support-Formatter">
<Title />
<div>
<Form />
</div>
</Layout>
<style>
main {
margin: auto;
padding: 1rem;
width: 800px;
max-width: calc(100% - 2rem);
color: white;
font-size: 20px;
line-height: 1.6;
}
.astro-a {
position: absolute;
top: -32px;
left: 50%;
transform: translatex(-50%);
width: 220px;
height: auto;
z-index: -1;
}
h1 {
font-size: 4rem;
font-weight: 700;
line-height: 1;
text-align: center;
margin-bottom: 1em;
}
.text-gradient {
background-image: var(--accent-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-size: 400%;
background-position: 0%;
}
.instructions {
margin-bottom: 2rem;
border: 1px solid rgba(var(--accent-light), 25%);
background: linear-gradient(rgba(var(--accent-dark), 66%), rgba(var(--accent-dark), 33%));
padding: 1.5rem;
border-radius: 8px;
}
.instructions code {
font-size: 0.8em;
font-weight: bold;
background: rgba(var(--accent-light), 12%);
color: rgb(var(--accent-light));
border-radius: 4px;
padding: 0.3em 0.4em;
}
.instructions strong {
color: rgb(var(--accent-light));
}
.link-card-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
gap: 2rem;
padding: 0;
div {
display: flex;
flex-flow: column;
width: 100%;
align-items: center;
justify-content: center;
}
</style>
<style is:global>
:root {
--hover-scale: 1.05;
--speed: 50%;
--ease: 50%;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
--c-darkgray: #1e1e1e;
--c-duskgray: #242424;
--c-gray: #2e2e2e;
--c-lighter: #eee;
--c-lightgray: #3e3e3e;
--c-darkpurple: #b86cff;
--c-purplepink: #c105ff;
--c-darkergray: #1b1b1b;
--c-reddish: #ff0077;
}
body {
background: var(--c-lightgray);
margin: 0px;
}
.visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
</style>