feat: redesign to neubrutalism UI and secure Hugging Face Space from rate/resource limits
Browse files- .gitattributes +1 -0
- .github/workflows/keep-alive.yaml +61 -0
- DESIGN.md +129 -0
- api/generate.js +49 -0
- api/status.js +23 -0
- frontend/api/generate.js +49 -0
- frontend/api/status.js +23 -0
- frontend/index.html +505 -66
- frontend/middleware.js +150 -0
- frontend/public/favicon.png +2 -2
- frontend/public/og-image.png +3 -0
- frontend/public/robots.txt +4 -0
- frontend/public/sitemap.xml +21 -0
- frontend/src/main.js +193 -30
- frontend/src/styles/base.css +541 -68
- frontend/src/styles/components.css +720 -223
- frontend/src/styles/preview.css +251 -118
- frontend/vercel.json +29 -1
- frontend/vite.config.js +5 -0
- middleware.js +150 -0
- package.json +2 -1
- public/favicon.png +2 -2
- public/og-image.png +3 -0
- public/robots.txt +4 -0
- public/sitemap.xml +21 -0
- src/index.js +102 -20
- vercel.json +63 -0
.gitattributes
CHANGED
|
@@ -7,3 +7,4 @@ public/*.jpeg filter=lfs diff=lfs merge=lfs -text
|
|
| 7 |
public/*.ico filter=lfs diff=lfs merge=lfs -text
|
| 8 |
frontend/public/*.ico filter=lfs diff=lfs merge=lfs -text
|
| 9 |
frontend/public/*.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 7 |
public/*.ico filter=lfs diff=lfs merge=lfs -text
|
| 8 |
frontend/public/*.ico filter=lfs diff=lfs merge=lfs -text
|
| 9 |
frontend/public/*.png filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
|
.github/workflows/keep-alive.yaml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Hugging Face Keep Alive
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule:
|
| 5 |
+
# Runs every 6 hours (00:00, 06:00, 12:00, 18:00 UTC) to prevent free-tier space sleeping
|
| 6 |
+
- cron: '0 */6 * * *'
|
| 7 |
+
workflow_dispatch: # Allows manual trigger from GitHub Actions tab
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
keep-alive:
|
| 11 |
+
name: Ping Quote API Backend
|
| 12 |
+
runs-on: ubuntu-latest
|
| 13 |
+
timeout-minutes: 5
|
| 14 |
+
|
| 15 |
+
steps:
|
| 16 |
+
- name: Ping Hugging Face Space Status Endpoint
|
| 17 |
+
run: |
|
| 18 |
+
echo "📡 Checking Hugging Face backend status..."
|
| 19 |
+
HTTP_RESPONSE=$(curl -s -S --max-time 60 --retry 3 --retry-delay 5 -w "\n%{http_code}" \
|
| 20 |
+
-H "User-Agent: GitHub-Actions-KeepAlive/1.0" \
|
| 21 |
+
https://ilhamdev-quote-api.hf.space/status)
|
| 22 |
+
|
| 23 |
+
HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed '$d')
|
| 24 |
+
HTTP_STATUS=$(echo "$HTTP_RESPONSE" | tail -n 1)
|
| 25 |
+
|
| 26 |
+
echo "Response Status: $HTTP_STATUS"
|
| 27 |
+
echo "Response Body: $HTTP_BODY"
|
| 28 |
+
|
| 29 |
+
if [ "$HTTP_STATUS" -ne 200 ]; then
|
| 30 |
+
echo "❌ Hugging Face Space returned non-200 status code: $HTTP_STATUS"
|
| 31 |
+
exit 1
|
| 32 |
+
fi
|
| 33 |
+
echo "✅ Hugging Face Space is active and awake!"
|
| 34 |
+
|
| 35 |
+
- name: Warm Up Canvas Rendering Engine (Lightweight POST)
|
| 36 |
+
run: |
|
| 37 |
+
echo "🎨 Sending lightweight ping payload to warm up canvas engine..."
|
| 38 |
+
PAYLOAD='{"type":"quote","format":"png","backgroundColor":"#1b1e23","messages":[{"from":{"id":1,"name":"KeepAlive","title":"Bot"},"text":"Ping"}]}'
|
| 39 |
+
|
| 40 |
+
HTTP_RESPONSE=$(curl -s -S --max-time 60 --retry 2 --retry-delay 5 -w "\n%{http_code}" \
|
| 41 |
+
-X POST \
|
| 42 |
+
-H "Content-Type: application/json" \
|
| 43 |
+
-H "User-Agent: GitHub-Actions-KeepAlive/1.0" \
|
| 44 |
+
-d "$PAYLOAD" \
|
| 45 |
+
https://ilhamdev-quote-api.hf.space/)
|
| 46 |
+
|
| 47 |
+
HTTP_STATUS=$(echo "$HTTP_RESPONSE" | tail -n 1)
|
| 48 |
+
|
| 49 |
+
if [ "$HTTP_STATUS" -eq 200 ]; then
|
| 50 |
+
echo "✅ Canvas rendering pipeline is warm and responsive!"
|
| 51 |
+
else
|
| 52 |
+
echo "⚠️ Non-200 status on render ping ($HTTP_STATUS), but container was contacted."
|
| 53 |
+
fi
|
| 54 |
+
|
| 55 |
+
- name: Ping Vercel Subdomain Proxy
|
| 56 |
+
run: |
|
| 57 |
+
echo "🌐 Checking Subdomain proxy (qc.mangrusdi.my.id)..."
|
| 58 |
+
curl -s -S --max-time 30 \
|
| 59 |
+
-H "User-Agent: GitHub-Actions-KeepAlive/1.0" \
|
| 60 |
+
https://qc.mangrusdi.my.id/status || true
|
| 61 |
+
echo "✅ Proxy checked."
|
DESIGN.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
version: "alpha"
|
| 3 |
+
name: "Neubrutalism"
|
| 4 |
+
description: "Neubrutalist interface. Ideal for landing pages, saas. AI-ready template."
|
| 5 |
+
colors:
|
| 6 |
+
primary: "#FFEB3B"
|
| 7 |
+
secondary: "#FF5252"
|
| 8 |
+
tertiary: "#2196F3"
|
| 9 |
+
neutral: "#000000"
|
| 10 |
+
typography:
|
| 11 |
+
h1:
|
| 12 |
+
fontFamily: System UI stack
|
| 13 |
+
fontSize: 2.25rem
|
| 14 |
+
fontWeight: 700
|
| 15 |
+
body-md:
|
| 16 |
+
fontFamily: System UI stack
|
| 17 |
+
fontSize: 1rem
|
| 18 |
+
fontWeight: 400
|
| 19 |
+
label-caps:
|
| 20 |
+
fontFamily: System UI stack
|
| 21 |
+
fontSize: 0.75rem
|
| 22 |
+
fontWeight: 500
|
| 23 |
+
components:
|
| 24 |
+
button-primary:
|
| 25 |
+
backgroundColor: "{colors.primary}"
|
| 26 |
+
textColor: "{colors.neutral}"
|
| 27 |
+
padding: 12px
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Overview
|
| 31 |
+
|
| 32 |
+
Neubrutalist interface. Ideal for landing pages, saas. AI-ready template. Brutalism on the web was always a provocation. Raw HTML, system fonts, zero polish — it said "I don't care about your expectations." Neubrutalism kept the attitude but ditched the hostility. It's brutalism that actually wants you to click the button.
|
| 33 |
+
|
| 34 |
+
The turning point was Gumroad's 2021 redesign. Sahil Lavingia stripped the product down to thick black borders, flat primary colors, and offset drop shadows that looked like someone dragged a rectangle two pixels southeast. It was loud, playful, and unmistakably intentional. Designers noticed. Within months, the Figma community had dozens of neubrutalist UI kits climbing the charts.
|
| 35 |
+
|
| 36 |
+
What separates it from classic brutalism is warmth. Where brutalism embraced ugliness as ideology, neubrutalism uses bold geometry as decoration. The borders are thick but the corners can be rounded. The shadows are hard but the palette is candy-colored. It's confrontational aesthetics made approachable — punk rock in a good mood.
|
| 37 |
+
|
| 38 |
+
- Density: 5/10 — Balanced
|
| 39 |
+
- Variance: 4/10 — Moderate
|
| 40 |
+
- Motion: 4/10 — Subtle
|
| 41 |
+
|
| 42 |
+
- **Style:** Bold, Colorful, Raw, Playful
|
| 43 |
+
- **Keywords:** Bold borders, black outlines, primary colors, thick shadows, no gradients, flat colors, 45° shadows, playful, Gen Z
|
| 44 |
+
- **Era:** 2020s Modern
|
| 45 |
+
- **Light/Dark:** ✓ Full / ✓ Full
|
| 46 |
+
|
| 47 |
+
## Colors
|
| 48 |
+
|
| 49 |
+
- **#FFEB3B** (#FFEB3B) — Primary surface or dominant color
|
| 50 |
+
- **#FF5252** (#FF5252) — Secondary surface or text color
|
| 51 |
+
- **#2196F3** (#2196F3) — Supporting palette color
|
| 52 |
+
- **#000000** (#000000) — Supporting palette color
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
## Typography
|
| 56 |
+
|
| 57 |
+
- **Display / Hero:** System UI stack (-apple-system, sans-serif) — Weight 700, tight tracking, used for headline impact
|
| 58 |
+
- **Body:** System UI stack (-apple-system, sans-serif) — Weight 400, 16px/1.6 line-height, max 72ch per line
|
| 59 |
+
- **UI Labels / Captions:** System UI stack (-apple-system, sans-serif) — 0.875rem, weight 500, slight letter-spacing
|
| 60 |
+
- **Monospace:** JetBrains Mono — Used for code, metadata, and technical values
|
| 61 |
+
|
| 62 |
+
Scale:
|
| 63 |
+
- Hero: clamp(2.5rem, 5vw, 4rem)
|
| 64 |
+
- H1: 2.25rem
|
| 65 |
+
- H2: 1.5rem
|
| 66 |
+
- Body: 1rem / 1.6
|
| 67 |
+
- Small: 0.875rem
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
## Layout
|
| 71 |
+
|
| 72 |
+
- **Grid:** CSS Grid primary. Max-width containment: 1280px centered with 1.5rem side padding.
|
| 73 |
+
- **Spacing rhythm:** Balanced. Base unit: 0.5rem (8px).
|
| 74 |
+
- **Section vertical gaps:** clamp(4rem, 8vw, 8rem).
|
| 75 |
+
- **Hero layout:** Split-screen (text left, visual right).
|
| 76 |
+
- **Feature sections:** Zig-zag alternating text+image rows. No 3-equal-columns.
|
| 77 |
+
- **Mobile collapse:** All multi-column layouts collapse below 768px. No horizontal overflow.
|
| 78 |
+
- **z-index contract:** base (0) / sticky-nav (100) / overlay (200) / modal (300) / toast (500).
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
## Elevation & Depth
|
| 82 |
+
|
| 83 |
+
box-shadow: 4px 4px 0 #000, border: 3px solid #000, no gradients, sharp corners (0px), bold typography
|
| 84 |
+
|
| 85 |
+
- **Physics:** Ease-out curves, 200-300ms duration. Smooth and predictable.
|
| 86 |
+
- **Entry animations:** Fade + translate-Y (16px → 0) over 420ms ease-out. Staggered cascades for lists: 80ms between items.
|
| 87 |
+
- **Hover states:** Subtle color shift + shadow adjustment over 200ms.
|
| 88 |
+
- **Page transitions:** Fade only (200ms).
|
| 89 |
+
- **Performance:** Only transform and opacity animated. No layout-triggering properties.
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
## Shapes
|
| 93 |
+
|
| 94 |
+
Base corner radius: 8px. See rounded tokens in front matter for the full scale.
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
## Components
|
| 98 |
+
|
| 99 |
+
- **Primary Button:** Subtly rounded (0.5rem) shape. Accent color fill. Hover: 8% darken + subtle lift shadow. Active: -1px translate tactile press. Font weight 600. No outer glows.
|
| 100 |
+
- **Secondary / Ghost Button:** Outline variant. 1.5px border in muted color. Text in primary color. Hover: subtle background fill.
|
| 101 |
+
- **Cards:** Subtly rounded (0.5rem) corners. Surface background. Subtle shadow (0 2px 12px rgba(0,0,0,0.06)). 1px border stroke.
|
| 102 |
+
- **Inputs:** Label above input. 1px border stroke. Focus ring: 2px accent color offset 2px. Error text below in semantic red. No floating labels.
|
| 103 |
+
- **Navigation:** Primary surface background. Active item: accent color indicator. Font weight 500 when active.
|
| 104 |
+
- **Skeletons:** Shimmer animation matching component dimensions. No circular spinners.
|
| 105 |
+
- **Empty States:** Icon-based composition with descriptive text and action button.
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
## Do's and Don'ts
|
| 109 |
+
|
| 110 |
+
- No emojis in UI — use icon system only (Lucide, Heroicons)
|
| 111 |
+
- No pure black (#000000) — use off-black or charcoal variants
|
| 112 |
+
- No oversaturated accent colors (saturation cap: 80%)
|
| 113 |
+
- No 3-column equal-width feature layouts — use zig-zag or asymmetric grid
|
| 114 |
+
- No `h-screen` — use `min-h-[100dvh]`
|
| 115 |
+
- No AI copywriting clichés: "Elevate", "Seamless", "Unleash", "Next-Gen"
|
| 116 |
+
- No broken external image links — use picsum.photos or inline SVG
|
| 117 |
+
- No generic lorem ipsum in demos
|
| 118 |
+
|
| 119 |
+
- Do Hard borders (2-4px)
|
| 120 |
+
- Do Hard offset shadows
|
| 121 |
+
- Do High saturation colors
|
| 122 |
+
- Do Bold typography
|
| 123 |
+
- Do No blurs/gradients
|
| 124 |
+
- Do Distinctive 'ugly-cute' look
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
## Use Case
|
| 128 |
+
|
| 129 |
+
Landing pages, SaaS
|
api/generate.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Vercel Serverless Function: /api/generate
|
| 3 |
+
* Proxies POST quote generation requests to Hugging Face backend
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
export default async function handler(req, res) {
|
| 7 |
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
| 8 |
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
| 9 |
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
|
| 10 |
+
|
| 11 |
+
if (req.method === 'OPTIONS') {
|
| 12 |
+
return res.status(204).end();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
if (req.method === 'POST') {
|
| 16 |
+
try {
|
| 17 |
+
const body = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
| 18 |
+
const hfRes = await fetch('https://ilhamdev-quote-api.hf.space/', {
|
| 19 |
+
method: 'POST',
|
| 20 |
+
headers: {
|
| 21 |
+
'Content-Type': req.headers['content-type'] || 'application/json',
|
| 22 |
+
},
|
| 23 |
+
body: body,
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
const contentType = hfRes.headers.get('content-type') || 'application/json';
|
| 27 |
+
res.setHeader('Content-Type', contentType);
|
| 28 |
+
|
| 29 |
+
if (contentType.includes('image')) {
|
| 30 |
+
const arrayBuf = await hfRes.arrayBuffer();
|
| 31 |
+
return res.status(hfRes.status).send(Buffer.from(arrayBuf));
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const text = await hfRes.text();
|
| 35 |
+
return res.status(hfRes.status).send(text);
|
| 36 |
+
} catch (err) {
|
| 37 |
+
return res.status(502).json({ status: false, message: `Proxy error: ${err.message}` });
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if (req.method === 'GET') {
|
| 42 |
+
return res.status(200).json({
|
| 43 |
+
status: true,
|
| 44 |
+
message: 'Quote API Subdomain Proxy active. Send POST requests to generate quotes.',
|
| 45 |
+
});
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
return res.status(405).json({ status: false, message: 'Method Not Allowed' });
|
| 49 |
+
}
|
api/status.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Vercel Serverless Function: /api/status
|
| 3 |
+
* Health check proxied to Hugging Face backend
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
export default async function handler(req, res) {
|
| 7 |
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
| 8 |
+
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
| 9 |
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
|
| 10 |
+
|
| 11 |
+
if (req.method === 'OPTIONS') {
|
| 12 |
+
return res.status(204).end();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
try {
|
| 16 |
+
const hfRes = await fetch('https://ilhamdev-quote-api.hf.space/status');
|
| 17 |
+
const text = await hfRes.text();
|
| 18 |
+
res.setHeader('Content-Type', 'application/json');
|
| 19 |
+
return res.status(hfRes.status).send(text);
|
| 20 |
+
} catch (err) {
|
| 21 |
+
return res.status(502).json({ status: false, message: 'Backend unreachable' });
|
| 22 |
+
}
|
| 23 |
+
}
|
frontend/api/generate.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Vercel Serverless Function: /api/generate
|
| 3 |
+
* Proxies POST quote generation requests to Hugging Face backend
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
export default async function handler(req, res) {
|
| 7 |
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
| 8 |
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
| 9 |
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
|
| 10 |
+
|
| 11 |
+
if (req.method === 'OPTIONS') {
|
| 12 |
+
return res.status(204).end();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
if (req.method === 'POST') {
|
| 16 |
+
try {
|
| 17 |
+
const body = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
| 18 |
+
const hfRes = await fetch('https://ilhamdev-quote-api.hf.space/', {
|
| 19 |
+
method: 'POST',
|
| 20 |
+
headers: {
|
| 21 |
+
'Content-Type': req.headers['content-type'] || 'application/json',
|
| 22 |
+
},
|
| 23 |
+
body: body,
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
const contentType = hfRes.headers.get('content-type') || 'application/json';
|
| 27 |
+
res.setHeader('Content-Type', contentType);
|
| 28 |
+
|
| 29 |
+
if (contentType.includes('image')) {
|
| 30 |
+
const arrayBuf = await hfRes.arrayBuffer();
|
| 31 |
+
return res.status(hfRes.status).send(Buffer.from(arrayBuf));
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const text = await hfRes.text();
|
| 35 |
+
return res.status(hfRes.status).send(text);
|
| 36 |
+
} catch (err) {
|
| 37 |
+
return res.status(502).json({ status: false, message: `Proxy error: ${err.message}` });
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if (req.method === 'GET') {
|
| 42 |
+
return res.status(200).json({
|
| 43 |
+
status: true,
|
| 44 |
+
message: 'Quote API Subdomain Proxy active. Send POST requests to generate quotes.',
|
| 45 |
+
});
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
return res.status(405).json({ status: false, message: 'Method Not Allowed' });
|
| 49 |
+
}
|
frontend/api/status.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Vercel Serverless Function: /api/status
|
| 3 |
+
* Health check proxied to Hugging Face backend
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
export default async function handler(req, res) {
|
| 7 |
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
| 8 |
+
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
| 9 |
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
|
| 10 |
+
|
| 11 |
+
if (req.method === 'OPTIONS') {
|
| 12 |
+
return res.status(204).end();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
try {
|
| 16 |
+
const hfRes = await fetch('https://ilhamdev-quote-api.hf.space/status');
|
| 17 |
+
const text = await hfRes.text();
|
| 18 |
+
res.setHeader('Content-Type', 'application/json');
|
| 19 |
+
return res.status(hfRes.status).send(text);
|
| 20 |
+
} catch (err) {
|
| 21 |
+
return res.status(502).json({ status: false, message: 'Backend unreachable' });
|
| 22 |
+
}
|
| 23 |
+
}
|
frontend/index.html
CHANGED
|
@@ -3,20 +3,118 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
-
<title>Telegram Quote Maker & API
|
| 7 |
<meta
|
| 8 |
name="description"
|
| 9 |
-
content="
|
| 10 |
/>
|
| 11 |
-
<meta name="keywords" content="telegram quote generator, fake chat maker, quotly api, telegram sticker quote, quote maker web" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
| 13 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
| 14 |
<link
|
| 15 |
-
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=
|
| 16 |
rel="stylesheet"
|
| 17 |
/>
|
| 18 |
<link rel="icon" type="image/png" href="/favicon.png" />
|
| 19 |
<link rel="alternate icon" href="/favicon.ico" />
|
|
|
|
|
|
|
| 20 |
<link rel="stylesheet" href="./src/styles/base.css" />
|
| 21 |
<link rel="stylesheet" href="./src/styles/components.css" />
|
| 22 |
<link rel="stylesheet" href="./src/styles/preview.css" />
|
|
@@ -25,47 +123,96 @@
|
|
| 25 |
<div id="app" class="app-layout">
|
| 26 |
<!-- Top Navbar -->
|
| 27 |
<header class="navbar">
|
| 28 |
-
<
|
| 29 |
-
<
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
<path d="M12 10h.01"></path>
|
| 34 |
-
<path d="M16 10h.01"></path>
|
| 35 |
-
</svg>
|
| 36 |
-
</div>
|
| 37 |
-
<div>
|
| 38 |
-
<h1 class="brand-title">Quote Studio</h1>
|
| 39 |
-
<p class="brand-sub">Telegram Quote Generator & API</p>
|
| 40 |
</div>
|
| 41 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
<div class="nav-actions">
|
| 44 |
<div id="apiStatusBadge" class="status-badge checking">
|
| 45 |
<span class="status-dot"></span>
|
| 46 |
-
<span id="apiStatusText">Checking API...</span>
|
| 47 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
<a
|
| 49 |
-
href="https://
|
| 50 |
target="_blank"
|
| 51 |
rel="noopener noreferrer"
|
| 52 |
class="nav-link-btn"
|
| 53 |
-
title="
|
| 54 |
>
|
| 55 |
-
<span>
|
| 56 |
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 57 |
-
<path d="
|
| 58 |
-
<polyline points="15 3 21 3 21 9"></polyline>
|
| 59 |
-
<line x1="10" y1="14" x2="21" y2="3"></line>
|
| 60 |
</svg>
|
| 61 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
</div>
|
| 63 |
</header>
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
<!-- Main Studio Grid -->
|
| 66 |
-
<main class="studio-container">
|
| 67 |
<!-- Left: Form Controls Panel -->
|
| 68 |
-
<section class="panel editor-panel" aria-labelledby="editorHeading">
|
| 69 |
<div class="panel-header">
|
| 70 |
<h2 id="editorHeading" class="panel-title">Quote Customizer</h2>
|
| 71 |
<button id="resetFormBtn" type="button" class="btn-text" title="Reset form to default values">Reset</button>
|
|
@@ -73,14 +220,14 @@
|
|
| 73 |
|
| 74 |
<form id="quoteForm" class="editor-form" autocomplete="off">
|
| 75 |
<!-- Section: Sender Info -->
|
| 76 |
-
<
|
| 77 |
-
<
|
| 78 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 79 |
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
| 80 |
<circle cx="12" cy="7" r="4"></circle>
|
| 81 |
</svg>
|
| 82 |
-
Sender Information
|
| 83 |
-
</
|
| 84 |
|
| 85 |
<div class="form-row">
|
| 86 |
<div class="form-group flex-2">
|
|
@@ -110,7 +257,7 @@
|
|
| 110 |
|
| 111 |
<!-- Avatar Management -->
|
| 112 |
<div class="form-group">
|
| 113 |
-
<label>Avatar Photo</label>
|
| 114 |
<div class="avatar-tabs">
|
| 115 |
<div class="avatar-input-wrapper">
|
| 116 |
<input
|
|
@@ -139,16 +286,16 @@
|
|
| 139 |
<button type="button" class="preset-avatar-btn" data-url="https://api.dicebear.com/7.x/notionists/svg?seed=Felix">Alex</button>
|
| 140 |
</div>
|
| 141 |
</div>
|
| 142 |
-
</
|
| 143 |
|
| 144 |
<!-- Section: Message Content -->
|
| 145 |
-
<
|
| 146 |
-
<
|
| 147 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 148 |
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
|
| 149 |
</svg>
|
| 150 |
-
Message Content
|
| 151 |
-
</
|
| 152 |
|
| 153 |
<div class="form-group">
|
| 154 |
<label for="messageText">Chat Text <span class="required">*</span></label>
|
|
@@ -214,11 +361,11 @@
|
|
| 214 |
/>
|
| 215 |
</div>
|
| 216 |
</div>
|
| 217 |
-
</
|
| 218 |
|
| 219 |
<!-- Section: Output & Styling -->
|
| 220 |
-
<
|
| 221 |
-
<
|
| 222 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 223 |
<circle cx="12" cy="12" r="10"></circle>
|
| 224 |
<path d="m4.93 4.93 4.24 4.24"></path>
|
|
@@ -226,8 +373,8 @@
|
|
| 226 |
<path d="m14.83 14.83 4.24 4.24"></path>
|
| 227 |
<path d="m9.17 14.83-4.24 4.24"></path>
|
| 228 |
</svg>
|
| 229 |
-
Output Style & Layout
|
| 230 |
-
</
|
| 231 |
|
| 232 |
<div class="form-row">
|
| 233 |
<div class="form-group flex-1">
|
|
@@ -272,21 +419,23 @@
|
|
| 272 |
<!-- Color Palette Quick Pick -->
|
| 273 |
<div class="palette-group">
|
| 274 |
<span class="quick-pick-label">Telegram Themes:</span>
|
| 275 |
-
<button type="button" class="palette-btn" data-color="#1b1e23" style="background: #1b1e23" title="Dark Slate"></button>
|
| 276 |
-
<button type="button" class="palette-btn" data-color="#0f172a" style="background: #0f172a" title="Midnight"></button>
|
| 277 |
-
<button type="button" class="palette-btn" data-color="#182533" style="background: #182533" title="Telegram Dark"></button>
|
| 278 |
-
<button type="button" class="palette-btn" data-color="#212d3b" style="background: #212d3b" title="Telegram Blue"></button>
|
| 279 |
-
<button type="button" class="palette-btn" data-color="#2d132c" style="background: #2d132c" title="Deep Plum"></button>
|
| 280 |
-
<button type="button" class="palette-btn" data-color="#172e27" style="background: #172e27" title="Forest Dark"></button>
|
| 281 |
</div>
|
| 282 |
-
</
|
| 283 |
|
| 284 |
<!-- Generate Action Button -->
|
| 285 |
<div class="form-actions">
|
| 286 |
<button id="generateBtn" type="button" class="btn-primary">
|
| 287 |
<span class="btn-icon">
|
| 288 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 289 |
-
<
|
|
|
|
|
|
|
| 290 |
</svg>
|
| 291 |
</span>
|
| 292 |
<span class="btn-text-label">Generate Quote Image</span>
|
|
@@ -295,13 +444,18 @@
|
|
| 295 |
</form>
|
| 296 |
</section>
|
| 297 |
|
| 298 |
-
<
|
| 299 |
-
<section class="panel preview-panel" aria-labelledby="previewHeading">
|
| 300 |
<div class="panel-header">
|
| 301 |
<h2 id="previewHeading" class="panel-title">Interactive Live Preview</h2>
|
| 302 |
<div class="preview-mode-tag" id="previewModeTag">Quote Mode</div>
|
| 303 |
</div>
|
| 304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
<!-- Telegram Bubble Simulated Preview Box -->
|
| 306 |
<div class="preview-stage-container" id="previewStage">
|
| 307 |
<div class="telegram-quote-card" id="simulatedBubble">
|
|
@@ -350,13 +504,13 @@
|
|
| 350 |
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
| 351 |
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
| 352 |
</svg>
|
| 353 |
-
Rendered by
|
| 354 |
</span>
|
| 355 |
<div class="result-info" id="resultMeta">PNG • 512x360</div>
|
| 356 |
</div>
|
| 357 |
|
| 358 |
<div class="result-preview-image-wrap">
|
| 359 |
-
<img id="renderedImage" src="" alt="Rendered Quote" class="rendered-image" />
|
| 360 |
</div>
|
| 361 |
|
| 362 |
<div class="result-actions">
|
|
@@ -364,7 +518,7 @@
|
|
| 364 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 365 |
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
| 366 |
<polyline points="7 10 12 15 17 10"></polyline>
|
| 367 |
-
<line x1="12" y1="
|
| 368 |
</svg>
|
| 369 |
Download Image
|
| 370 |
</a>
|
|
@@ -382,27 +536,312 @@
|
|
| 382 |
<div class="api-playground-box">
|
| 383 |
<div class="playground-header">
|
| 384 |
<span class="playground-title">Developer Integration Snippet</span>
|
| 385 |
-
<div class="
|
| 386 |
-
<
|
| 387 |
-
|
| 388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
</div>
|
| 390 |
</div>
|
| 391 |
|
| 392 |
<div class="snippet-viewer">
|
| 393 |
-
<pre><code id="codeSnippet" class="code-block">curl -X POST https://
|
| 394 |
-
<button id="copySnippetBtn" type="button" class="copy-snippet-btn" title="Copy code snippet">
|
| 395 |
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 396 |
-
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
| 397 |
-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
| 398 |
-
</svg>
|
| 399 |
-
<span>Copy</span>
|
| 400 |
-
</button>
|
| 401 |
</div>
|
| 402 |
</div>
|
| 403 |
</section>
|
| 404 |
</main>
|
| 405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
<!-- Global Toast Container -->
|
| 407 |
<div id="toast" class="toast hidden" role="alert" aria-live="polite"></div>
|
| 408 |
</div>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Telegram Quote Maker & Generator REST API | Mang Rusdi</title>
|
| 7 |
<meta
|
| 8 |
name="description"
|
| 9 |
+
content="Generate high-resolution Telegram chat bubble quotes, transparent stickers, and vertical stories. Web customizer and public REST API on qc.mangrusdi.my.id."
|
| 10 |
/>
|
| 11 |
+
<meta name="keywords" content="telegram quote generator, fake chat maker, quotly api, telegram sticker quote, quote maker web, telegram bot api" />
|
| 12 |
+
<meta name="author" content="Rusdi Ilham" />
|
| 13 |
+
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1" />
|
| 14 |
+
<link rel="canonical" href="https://qc.mangrusdi.my.id/" />
|
| 15 |
+
|
| 16 |
+
<!-- Open Graph / Facebook -->
|
| 17 |
+
<meta property="og:type" content="website" />
|
| 18 |
+
<meta property="og:locale" content="en_US" />
|
| 19 |
+
<meta property="og:url" content="https://qc.mangrusdi.my.id/" />
|
| 20 |
+
<meta property="og:site_name" content="Quote Studio" />
|
| 21 |
+
<meta property="og:title" content="Telegram Quote Maker & Generator REST API" />
|
| 22 |
+
<meta
|
| 23 |
+
property="og:description"
|
| 24 |
+
content="Generate high-resolution Telegram chat bubble quotes, transparent stickers, and vertical stories with real-time preview and free REST API."
|
| 25 |
+
/>
|
| 26 |
+
<meta property="og:image" content="https://qc.mangrusdi.my.id/og-image.png" />
|
| 27 |
+
<meta property="og:image:width" content="1200" />
|
| 28 |
+
<meta property="og:image:height" content="630" />
|
| 29 |
+
<meta property="og:image:alt" content="Telegram Quote Studio Interface" />
|
| 30 |
+
|
| 31 |
+
<!-- Twitter Cards -->
|
| 32 |
+
<meta name="twitter:card" content="summary_large_image" />
|
| 33 |
+
<meta name="twitter:title" content="Telegram Quote Maker & Generator REST API" />
|
| 34 |
+
<meta
|
| 35 |
+
name="twitter:description"
|
| 36 |
+
content="Generate high-resolution Telegram chat bubble quotes, transparent stickers, and vertical stories with real-time preview and free REST API."
|
| 37 |
+
/>
|
| 38 |
+
<meta name="twitter:image" content="https://qc.mangrusdi.my.id/og-image.png" />
|
| 39 |
+
|
| 40 |
+
<!-- JSON-LD Structured Data for Google Search Console -->
|
| 41 |
+
<script type="application/ld+json">
|
| 42 |
+
{
|
| 43 |
+
"@context": "https://schema.org",
|
| 44 |
+
"@graph": [
|
| 45 |
+
{
|
| 46 |
+
"@type": "WebApplication",
|
| 47 |
+
"@id": "https://qc.mangrusdi.my.id/#app",
|
| 48 |
+
"name": "Telegram Quote Maker & Generator REST API",
|
| 49 |
+
"url": "https://qc.mangrusdi.my.id/",
|
| 50 |
+
"applicationCategory": "MultimediaApplication",
|
| 51 |
+
"operatingSystem": "All",
|
| 52 |
+
"inLanguage": "en",
|
| 53 |
+
"description": "Generate Telegram message bubble quotes, transparent stickers, and 9:16 vertical stories with live preview and open REST API endpoints.",
|
| 54 |
+
"offers": {
|
| 55 |
+
"@type": "Offer",
|
| 56 |
+
"price": "0",
|
| 57 |
+
"priceCurrency": "USD"
|
| 58 |
+
},
|
| 59 |
+
"author": {
|
| 60 |
+
"@type": "Person",
|
| 61 |
+
"name": "Rusdi Ilham",
|
| 62 |
+
"url": "https://github.com/RusdiEneri"
|
| 63 |
+
}
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"@type": "FAQPage",
|
| 67 |
+
"@id": "https://qc.mangrusdi.my.id/#faq",
|
| 68 |
+
"mainEntity": [
|
| 69 |
+
{
|
| 70 |
+
"@type": "Question",
|
| 71 |
+
"name": "How to generate quote stickers using the REST API?",
|
| 72 |
+
"acceptedAnswer": {
|
| 73 |
+
"@type": "Answer",
|
| 74 |
+
"text": "Send an HTTP POST request to https://qc.mangrusdi.my.id/generate with Content-Type: application/json and a messages array payload containing sender details and message text. The server returns high resolution PNG or WebP image data."
|
| 75 |
+
}
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"@type": "Question",
|
| 79 |
+
"name": "Which output formats are supported?",
|
| 80 |
+
"acceptedAnswer": {
|
| 81 |
+
"@type": "Answer",
|
| 82 |
+
"text": "The API supports PNG lossless image rendering with full alpha transparency, as well as WebP format for optimized file size in web and bot integrations."
|
| 83 |
+
}
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"@type": "Question",
|
| 87 |
+
"name": "Can I use custom avatar pictures?",
|
| 88 |
+
"acceptedAnswer": {
|
| 89 |
+
"@type": "Answer",
|
| 90 |
+
"text": "Yes. Provide a public image URL or upload an image file through the web customizer, which converts local photos into base64 format automatically."
|
| 91 |
+
}
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"@type": "Question",
|
| 95 |
+
"name": "Is there a health check endpoint?",
|
| 96 |
+
"acceptedAnswer": {
|
| 97 |
+
"@type": "Answer",
|
| 98 |
+
"text": "Yes, send an HTTP GET request to https://qc.mangrusdi.my.id/status to check server uptime and operational status."
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
]
|
| 102 |
+
}
|
| 103 |
+
]
|
| 104 |
+
}
|
| 105 |
+
</script>
|
| 106 |
+
|
| 107 |
+
<!-- Fonts & Icons -->
|
| 108 |
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
| 109 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
| 110 |
<link
|
| 111 |
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
| 112 |
rel="stylesheet"
|
| 113 |
/>
|
| 114 |
<link rel="icon" type="image/png" href="/favicon.png" />
|
| 115 |
<link rel="alternate icon" href="/favicon.ico" />
|
| 116 |
+
|
| 117 |
+
<!-- Stylesheets -->
|
| 118 |
<link rel="stylesheet" href="./src/styles/base.css" />
|
| 119 |
<link rel="stylesheet" href="./src/styles/components.css" />
|
| 120 |
<link rel="stylesheet" href="./src/styles/preview.css" />
|
|
|
|
| 123 |
<div id="app" class="app-layout">
|
| 124 |
<!-- Top Navbar -->
|
| 125 |
<header class="navbar">
|
| 126 |
+
<a href="#studio" class="brand" title="Quote Studio Home">
|
| 127 |
+
<img src="/favicon.png" alt="Quote Studio Logo" class="brand-logo" width="44" height="44" />
|
| 128 |
+
<div class="brand-title-wrap">
|
| 129 |
+
<h1 class="brand-title">Quote Studio <span class="brand-tag">Neubrutal</span></h1>
|
| 130 |
+
<p class="brand-sub">Telegram Quote Generator & REST API</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
</div>
|
| 132 |
+
</a>
|
| 133 |
+
|
| 134 |
+
<nav class="nav-links" aria-label="Page Navigation">
|
| 135 |
+
<a href="#studio" class="nav-anchor">Studio</a>
|
| 136 |
+
<a href="#api-docs" class="nav-anchor">API Endpoints</a>
|
| 137 |
+
<a href="#specs" class="nav-anchor">Formats</a>
|
| 138 |
+
<a href="#faq" class="nav-anchor">FAQ</a>
|
| 139 |
+
</nav>
|
| 140 |
|
| 141 |
<div class="nav-actions">
|
| 142 |
<div id="apiStatusBadge" class="status-badge checking">
|
| 143 |
<span class="status-dot"></span>
|
| 144 |
+
<span id="apiStatusText" class="status-text">Checking API...</span>
|
| 145 |
</div>
|
| 146 |
+
|
| 147 |
+
<!-- Neubrutalism Light / Dark Mode Toggle -->
|
| 148 |
+
<button
|
| 149 |
+
type="button"
|
| 150 |
+
id="themeToggleBtn"
|
| 151 |
+
class="theme-toggle-btn"
|
| 152 |
+
title="Toggle Light / Dark Mode"
|
| 153 |
+
aria-label="Toggle Light or Dark Theme"
|
| 154 |
+
>
|
| 155 |
+
<svg id="themeIconSun" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
| 156 |
+
<circle cx="12" cy="12" r="5"></circle>
|
| 157 |
+
<line x1="12" y1="1" x2="12" y2="3"></line>
|
| 158 |
+
<line x1="12" y1="21" x2="12" y2="23"></line>
|
| 159 |
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
| 160 |
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
| 161 |
+
<line x1="1" y1="12" x2="3" y2="12"></line>
|
| 162 |
+
<line x1="21" y1="12" x2="23" y2="12"></line>
|
| 163 |
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
|
| 164 |
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
| 165 |
+
</svg>
|
| 166 |
+
<svg id="themeIconMoon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" style="display: none;">
|
| 167 |
+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
|
| 168 |
+
</svg>
|
| 169 |
+
</button>
|
| 170 |
+
|
| 171 |
<a
|
| 172 |
+
href="https://github.com/RusdiEneri/quote"
|
| 173 |
target="_blank"
|
| 174 |
rel="noopener noreferrer"
|
| 175 |
class="nav-link-btn"
|
| 176 |
+
title="GitHub Repository"
|
| 177 |
>
|
| 178 |
+
<span>GitHub</span>
|
| 179 |
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 180 |
+
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
|
|
|
|
|
|
| 181 |
</svg>
|
| 182 |
</a>
|
| 183 |
+
<button type="button" class="mobile-menu-btn" id="mobileMenuBtn" aria-label="Toggle navigation menu" aria-expanded="false">
|
| 184 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 185 |
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
| 186 |
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
| 187 |
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
| 188 |
+
</svg>
|
| 189 |
+
</button>
|
| 190 |
</div>
|
| 191 |
</header>
|
| 192 |
|
| 193 |
+
<!-- Mobile View Switcher (Visible on small screens) -->
|
| 194 |
+
<div class="mobile-studio-switcher" role="tablist" aria-label="Studio View Switcher">
|
| 195 |
+
<button type="button" class="studio-tab-btn active" id="tabEditorBtn" role="tab" aria-selected="true" aria-controls="editorPanel">
|
| 196 |
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 197 |
+
<path d="M12 20h9"></path>
|
| 198 |
+
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>
|
| 199 |
+
</svg>
|
| 200 |
+
<span>Customizer</span>
|
| 201 |
+
</button>
|
| 202 |
+
<button type="button" class="studio-tab-btn" id="tabPreviewBtn" role="tab" aria-selected="false" aria-controls="previewPanel">
|
| 203 |
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 204 |
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
|
| 205 |
+
<circle cx="12" cy="12" r="3"></circle>
|
| 206 |
+
</svg>
|
| 207 |
+
<span>Live Preview</span>
|
| 208 |
+
<span class="tab-badge" id="previewBadgeLive">Live</span>
|
| 209 |
+
</button>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
<!-- Main Studio Grid -->
|
| 213 |
+
<main class="studio-container" id="studio">
|
| 214 |
<!-- Left: Form Controls Panel -->
|
| 215 |
+
<section class="panel editor-panel active-mobile-view" id="editorPanel" aria-labelledby="editorHeading">
|
| 216 |
<div class="panel-header">
|
| 217 |
<h2 id="editorHeading" class="panel-title">Quote Customizer</h2>
|
| 218 |
<button id="resetFormBtn" type="button" class="btn-text" title="Reset form to default values">Reset</button>
|
|
|
|
| 220 |
|
| 221 |
<form id="quoteForm" class="editor-form" autocomplete="off">
|
| 222 |
<!-- Section: Sender Info -->
|
| 223 |
+
<div class="form-section" role="group" aria-labelledby="senderInfoHeading">
|
| 224 |
+
<div class="section-title" id="senderInfoHeading">
|
| 225 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 226 |
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
| 227 |
<circle cx="12" cy="7" r="4"></circle>
|
| 228 |
</svg>
|
| 229 |
+
<span>Sender Information</span>
|
| 230 |
+
</div>
|
| 231 |
|
| 232 |
<div class="form-row">
|
| 233 |
<div class="form-group flex-2">
|
|
|
|
| 257 |
|
| 258 |
<!-- Avatar Management -->
|
| 259 |
<div class="form-group">
|
| 260 |
+
<label for="avatarUrl">Avatar Photo</label>
|
| 261 |
<div class="avatar-tabs">
|
| 262 |
<div class="avatar-input-wrapper">
|
| 263 |
<input
|
|
|
|
| 286 |
<button type="button" class="preset-avatar-btn" data-url="https://api.dicebear.com/7.x/notionists/svg?seed=Felix">Alex</button>
|
| 287 |
</div>
|
| 288 |
</div>
|
| 289 |
+
</div>
|
| 290 |
|
| 291 |
<!-- Section: Message Content -->
|
| 292 |
+
<div class="form-section" role="group" aria-labelledby="messageContentHeading">
|
| 293 |
+
<div class="section-title" id="messageContentHeading">
|
| 294 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 295 |
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
|
| 296 |
</svg>
|
| 297 |
+
<span>Message Content</span>
|
| 298 |
+
</div>
|
| 299 |
|
| 300 |
<div class="form-group">
|
| 301 |
<label for="messageText">Chat Text <span class="required">*</span></label>
|
|
|
|
| 361 |
/>
|
| 362 |
</div>
|
| 363 |
</div>
|
| 364 |
+
</div>
|
| 365 |
|
| 366 |
<!-- Section: Output & Styling -->
|
| 367 |
+
<div class="form-section" role="group" aria-labelledby="outputStyleHeading">
|
| 368 |
+
<div class="section-title" id="outputStyleHeading">
|
| 369 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 370 |
<circle cx="12" cy="12" r="10"></circle>
|
| 371 |
<path d="m4.93 4.93 4.24 4.24"></path>
|
|
|
|
| 373 |
<path d="m14.83 14.83 4.24 4.24"></path>
|
| 374 |
<path d="m9.17 14.83-4.24 4.24"></path>
|
| 375 |
</svg>
|
| 376 |
+
<span>Output Style & Layout</span>
|
| 377 |
+
</div>
|
| 378 |
|
| 379 |
<div class="form-row">
|
| 380 |
<div class="form-group flex-1">
|
|
|
|
| 419 |
<!-- Color Palette Quick Pick -->
|
| 420 |
<div class="palette-group">
|
| 421 |
<span class="quick-pick-label">Telegram Themes:</span>
|
| 422 |
+
<button type="button" class="palette-btn active" data-color="#1b1e23" style="background: #1b1e23" title="Dark Slate" aria-label="Dark Slate Theme"></button>
|
| 423 |
+
<button type="button" class="palette-btn" data-color="#0f172a" style="background: #0f172a" title="Midnight" aria-label="Midnight Theme"></button>
|
| 424 |
+
<button type="button" class="palette-btn" data-color="#182533" style="background: #182533" title="Telegram Dark" aria-label="Telegram Dark Theme"></button>
|
| 425 |
+
<button type="button" class="palette-btn" data-color="#212d3b" style="background: #212d3b" title="Telegram Blue" aria-label="Telegram Blue Theme"></button>
|
| 426 |
+
<button type="button" class="palette-btn" data-color="#2d132c" style="background: #2d132c" title="Deep Plum" aria-label="Deep Plum Theme"></button>
|
| 427 |
+
<button type="button" class="palette-btn" data-color="#172e27" style="background: #172e27" title="Forest Dark" aria-label="Forest Dark Theme"></button>
|
| 428 |
</div>
|
| 429 |
+
</div>
|
| 430 |
|
| 431 |
<!-- Generate Action Button -->
|
| 432 |
<div class="form-actions">
|
| 433 |
<button id="generateBtn" type="button" class="btn-primary">
|
| 434 |
<span class="btn-icon">
|
| 435 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 436 |
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
| 437 |
+
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
| 438 |
+
<polyline points="21 15 16 10 5 21"></polyline>
|
| 439 |
</svg>
|
| 440 |
</span>
|
| 441 |
<span class="btn-text-label">Generate Quote Image</span>
|
|
|
|
| 444 |
</form>
|
| 445 |
</section>
|
| 446 |
|
| 447 |
+
<section class="panel preview-panel" id="previewPanel" aria-labelledby="previewHeading">
|
|
|
|
| 448 |
<div class="panel-header">
|
| 449 |
<h2 id="previewHeading" class="panel-title">Interactive Live Preview</h2>
|
| 450 |
<div class="preview-mode-tag" id="previewModeTag">Quote Mode</div>
|
| 451 |
</div>
|
| 452 |
|
| 453 |
+
<!-- Live Preview Metadata Strip -->
|
| 454 |
+
<div class="preview-meta-strip">
|
| 455 |
+
<span class="preview-meta-item">Format: <strong id="prevFormatMeta">PNG (512px max)</strong></span>
|
| 456 |
+
<span class="preview-meta-item">Theme: <strong id="prevBgMeta">#1B1E23</strong></span>
|
| 457 |
+
</div>
|
| 458 |
+
|
| 459 |
<!-- Telegram Bubble Simulated Preview Box -->
|
| 460 |
<div class="preview-stage-container" id="previewStage">
|
| 461 |
<div class="telegram-quote-card" id="simulatedBubble">
|
|
|
|
| 504 |
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
| 505 |
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
| 506 |
</svg>
|
| 507 |
+
Rendered by Quote API
|
| 508 |
</span>
|
| 509 |
<div class="result-info" id="resultMeta">PNG • 512x360</div>
|
| 510 |
</div>
|
| 511 |
|
| 512 |
<div class="result-preview-image-wrap">
|
| 513 |
+
<img id="renderedImage" src="" alt="Rendered Quote Output" class="rendered-image" />
|
| 514 |
</div>
|
| 515 |
|
| 516 |
<div class="result-actions">
|
|
|
|
| 518 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 519 |
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
| 520 |
<polyline points="7 10 12 15 17 10"></polyline>
|
| 521 |
+
<line x1="12" y1="3" x2="12" y2="3"></line>
|
| 522 |
</svg>
|
| 523 |
Download Image
|
| 524 |
</a>
|
|
|
|
| 536 |
<div class="api-playground-box">
|
| 537 |
<div class="playground-header">
|
| 538 |
<span class="playground-title">Developer Integration Snippet</span>
|
| 539 |
+
<div class="playground-actions">
|
| 540 |
+
<div class="tab-buttons">
|
| 541 |
+
<button type="button" class="tab-btn active" data-tab="curl">cURL</button>
|
| 542 |
+
<button type="button" class="tab-btn" data-tab="js">JavaScript</button>
|
| 543 |
+
<button type="button" class="tab-btn" data-tab="py">Python</button>
|
| 544 |
+
</div>
|
| 545 |
+
<button id="copySnippetBtn" type="button" class="copy-snippet-btn" title="Copy code snippet">
|
| 546 |
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 547 |
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
| 548 |
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
| 549 |
+
</svg>
|
| 550 |
+
<span class="copy-label">Copy</span>
|
| 551 |
+
</button>
|
| 552 |
</div>
|
| 553 |
</div>
|
| 554 |
|
| 555 |
<div class="snippet-viewer">
|
| 556 |
+
<pre><code id="codeSnippet" class="code-block">curl -X POST https://qc.mangrusdi.my.id/generate ...</code></pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
</div>
|
| 558 |
</div>
|
| 559 |
</section>
|
| 560 |
</main>
|
| 561 |
|
| 562 |
+
<!-- Section: API Reference & Parameter Documentation -->
|
| 563 |
+
<section class="content-section" id="api-docs" aria-labelledby="apiDocsHeading">
|
| 564 |
+
<div class="section-header">
|
| 565 |
+
<h2 id="apiDocsHeading" class="section-heading">REST API Reference & Endpoints</h2>
|
| 566 |
+
<p class="section-desc">
|
| 567 |
+
Directly integrate Telegram quote generation into your Telegram bots, web apps, or backend services using our public endpoints.
|
| 568 |
+
</p>
|
| 569 |
+
</div>
|
| 570 |
+
|
| 571 |
+
<div class="table-responsive">
|
| 572 |
+
<table class="api-table">
|
| 573 |
+
<thead>
|
| 574 |
+
<tr>
|
| 575 |
+
<th>Method</th>
|
| 576 |
+
<th>Endpoint</th>
|
| 577 |
+
<th>Description</th>
|
| 578 |
+
<th>Content-Type</th>
|
| 579 |
+
</tr>
|
| 580 |
+
</thead>
|
| 581 |
+
<tbody>
|
| 582 |
+
<tr>
|
| 583 |
+
<td><span class="method-tag post">POST</span></td>
|
| 584 |
+
<td><code class="endpoint-path">https://qc.mangrusdi.my.id/generate</code></td>
|
| 585 |
+
<td>Main quote generator endpoint (returns base64 image and dimensions)</td>
|
| 586 |
+
<td><code>application/json</code></td>
|
| 587 |
+
</tr>
|
| 588 |
+
<tr>
|
| 589 |
+
<td><span class="method-tag post">POST</span></td>
|
| 590 |
+
<td><code class="endpoint-path">https://qc.mangrusdi.my.id/api/generate</code></td>
|
| 591 |
+
<td>Secondary proxy route for flexible integrations</td>
|
| 592 |
+
<td><code>application/json</code></td>
|
| 593 |
+
</tr>
|
| 594 |
+
<tr>
|
| 595 |
+
<td><span class="method-tag get">GET</span></td>
|
| 596 |
+
<td><code class="endpoint-path">https://qc.mangrusdi.my.id/status</code></td>
|
| 597 |
+
<td>Operational health check and service uptime info</td>
|
| 598 |
+
<td><code>application/json</code></td>
|
| 599 |
+
</tr>
|
| 600 |
+
</tbody>
|
| 601 |
+
</table>
|
| 602 |
+
</div>
|
| 603 |
+
|
| 604 |
+
<!-- Request Body Schema Documentation -->
|
| 605 |
+
<div class="section-header" style="margin-top: 2rem;">
|
| 606 |
+
<h3 class="section-heading" style="font-size: 1.15rem;">Request Payload Schema (JSON)</h3>
|
| 607 |
+
<p class="section-desc">
|
| 608 |
+
Payload properties accepted by the <code>POST /generate</code> endpoint.
|
| 609 |
+
</p>
|
| 610 |
+
</div>
|
| 611 |
+
|
| 612 |
+
<div class="table-responsive">
|
| 613 |
+
<table class="api-table">
|
| 614 |
+
<thead>
|
| 615 |
+
<tr>
|
| 616 |
+
<th>Field</th>
|
| 617 |
+
<th>Type</th>
|
| 618 |
+
<th>Requirement</th>
|
| 619 |
+
<th>Description</th>
|
| 620 |
+
</tr>
|
| 621 |
+
</thead>
|
| 622 |
+
<tbody>
|
| 623 |
+
<tr>
|
| 624 |
+
<td><code class="endpoint-path">messages</code></td>
|
| 625 |
+
<td><code>Array<Object></code></td>
|
| 626 |
+
<td><span class="required">Required</span></td>
|
| 627 |
+
<td>Array of message objects to be stacked into quote bubble canvas.</td>
|
| 628 |
+
</tr>
|
| 629 |
+
<tr>
|
| 630 |
+
<td><code class="endpoint-path">messages[].from.name</code></td>
|
| 631 |
+
<td><code>string</code></td>
|
| 632 |
+
<td><span class="required">Required</span></td>
|
| 633 |
+
<td>Sender display name shown at the top of the chat bubble.</td>
|
| 634 |
+
</tr>
|
| 635 |
+
<tr>
|
| 636 |
+
<td><code class="endpoint-path">messages[].text</code></td>
|
| 637 |
+
<td><code>string</code></td>
|
| 638 |
+
<td><span class="required">Required</span></td>
|
| 639 |
+
<td>The text message content. Supports Markdown & emojis.</td>
|
| 640 |
+
</tr>
|
| 641 |
+
<tr>
|
| 642 |
+
<td><code class="endpoint-path">messages[].from.title</code></td>
|
| 643 |
+
<td><code>string</code></td>
|
| 644 |
+
<td>Optional</td>
|
| 645 |
+
<td>Role badge next to the sender name (e.g. "Admin", "Owner").</td>
|
| 646 |
+
</tr>
|
| 647 |
+
<tr>
|
| 648 |
+
<td><code class="endpoint-path">messages[].from.photo.url</code></td>
|
| 649 |
+
<td><code>string</code></td>
|
| 650 |
+
<td>Optional</td>
|
| 651 |
+
<td>Public image URL or base64 data URI for sender avatar.</td>
|
| 652 |
+
</tr>
|
| 653 |
+
<tr>
|
| 654 |
+
<td><code class="endpoint-path">messages[].replyMessage</code></td>
|
| 655 |
+
<td><code>Object</code></td>
|
| 656 |
+
<td>Optional</td>
|
| 657 |
+
<td>Quoted reply box containing <code>name</code> and <code>text</code>.</td>
|
| 658 |
+
</tr>
|
| 659 |
+
<tr>
|
| 660 |
+
<td><code class="endpoint-path">type</code></td>
|
| 661 |
+
<td><code>string</code></td>
|
| 662 |
+
<td>Optional</td>
|
| 663 |
+
<td><code>"quote"</code> (sticker, 512px max), <code>"stories"</code> (9:16), or <code>"image"</code> (canvas).</td>
|
| 664 |
+
</tr>
|
| 665 |
+
<tr>
|
| 666 |
+
<td><code class="endpoint-path">format</code></td>
|
| 667 |
+
<td><code>string</code></td>
|
| 668 |
+
<td>Optional</td>
|
| 669 |
+
<td>Image compression format: <code>"png"</code> (lossless) or <code>"webp"</code>.</td>
|
| 670 |
+
</tr>
|
| 671 |
+
<tr>
|
| 672 |
+
<td><code class="endpoint-path">backgroundColor</code></td>
|
| 673 |
+
<td><code>string</code></td>
|
| 674 |
+
<td>Optional</td>
|
| 675 |
+
<td>Hex color string for chat bubble background (default: <code>"#1b1e23"</code>).</td>
|
| 676 |
+
</tr>
|
| 677 |
+
<tr>
|
| 678 |
+
<td><code class="endpoint-path">watermark</code></td>
|
| 679 |
+
<td><code>string</code></td>
|
| 680 |
+
<td>Optional</td>
|
| 681 |
+
<td>Branding watermark text applied on Stories and Canvas layouts.</td>
|
| 682 |
+
</tr>
|
| 683 |
+
</tbody>
|
| 684 |
+
</table>
|
| 685 |
+
</div>
|
| 686 |
+
</section>
|
| 687 |
+
|
| 688 |
+
<!-- Section: Output Formats & Specs -->
|
| 689 |
+
<section class="content-section" id="specs" aria-labelledby="specsHeading">
|
| 690 |
+
<div class="section-header">
|
| 691 |
+
<h2 id="specsHeading" class="section-heading">Supported Output Layouts</h2>
|
| 692 |
+
<p class="section-desc">
|
| 693 |
+
Choose the layout format suited to your media channel: transparent stickers, vertical stories, or wide canvas cards.
|
| 694 |
+
</p>
|
| 695 |
+
</div>
|
| 696 |
+
|
| 697 |
+
<div class="modes-grid">
|
| 698 |
+
<div class="mode-card">
|
| 699 |
+
<h3 class="mode-card-title">Quote Bubble (Sticker)</h3>
|
| 700 |
+
<p class="mode-card-desc">
|
| 701 |
+
Standard Telegram message bubble rendered with transparent background, ideal for creating Telegram sticker packs and bot replies.
|
| 702 |
+
</p>
|
| 703 |
+
<ul class="mode-specs-list">
|
| 704 |
+
<li>
|
| 705 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 706 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 707 |
+
</svg>
|
| 708 |
+
512px standard sticker width
|
| 709 |
+
</li>
|
| 710 |
+
<li>
|
| 711 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 712 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 713 |
+
</svg>
|
| 714 |
+
Full alpha channel transparency
|
| 715 |
+
</li>
|
| 716 |
+
<li>
|
| 717 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 718 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 719 |
+
</svg>
|
| 720 |
+
Supports replies and badges
|
| 721 |
+
</li>
|
| 722 |
+
</ul>
|
| 723 |
+
</div>
|
| 724 |
+
|
| 725 |
+
<div class="mode-card">
|
| 726 |
+
<h3 class="mode-card-title">Vertical Stories (9:16)</h3>
|
| 727 |
+
<p class="mode-card-desc">
|
| 728 |
+
High-resolution vertical format designed for Telegram Stories, WhatsApp Status, and Instagram Reels with custom background themes.
|
| 729 |
+
</p>
|
| 730 |
+
<ul class="mode-specs-list">
|
| 731 |
+
<li>
|
| 732 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 733 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 734 |
+
</svg>
|
| 735 |
+
1080 x 1920 portrait canvas
|
| 736 |
+
</li>
|
| 737 |
+
<li>
|
| 738 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 739 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 740 |
+
</svg>
|
| 741 |
+
4x supersampling resolution
|
| 742 |
+
</li>
|
| 743 |
+
<li>
|
| 744 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 745 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 746 |
+
</svg>
|
| 747 |
+
Custom watermark placement
|
| 748 |
+
</li>
|
| 749 |
+
</ul>
|
| 750 |
+
</div>
|
| 751 |
+
|
| 752 |
+
<div class="mode-card">
|
| 753 |
+
<h3 class="mode-card-title">Image Card (Canvas)</h3>
|
| 754 |
+
<p class="mode-card-desc">
|
| 755 |
+
Horizontal card presentation featuring elevation shadows, rounded frames, and clean padding for social media embeds and articles.
|
| 756 |
+
</p>
|
| 757 |
+
<ul class="mode-specs-list">
|
| 758 |
+
<li>
|
| 759 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 760 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 761 |
+
</svg>
|
| 762 |
+
1280 x 720 landscape canvas
|
| 763 |
+
</li>
|
| 764 |
+
<li>
|
| 765 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 766 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 767 |
+
</svg>
|
| 768 |
+
Soft elevation shadow
|
| 769 |
+
</li>
|
| 770 |
+
<li>
|
| 771 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 772 |
+
<polyline points="20 6 9 17 4 12"></polyline>
|
| 773 |
+
</svg>
|
| 774 |
+
Lossless PNG and compact WebP
|
| 775 |
+
</li>
|
| 776 |
+
</ul>
|
| 777 |
+
</div>
|
| 778 |
+
</div>
|
| 779 |
+
</section>
|
| 780 |
+
|
| 781 |
+
<!-- Section: Frequently Asked Questions -->
|
| 782 |
+
<section class="content-section" id="faq" aria-labelledby="faqHeading">
|
| 783 |
+
<div class="section-header">
|
| 784 |
+
<h2 id="faqHeading" class="section-heading">Frequently Asked Questions</h2>
|
| 785 |
+
<p class="section-desc">
|
| 786 |
+
Common questions regarding integration, file formats, and server capabilities.
|
| 787 |
+
</p>
|
| 788 |
+
</div>
|
| 789 |
+
|
| 790 |
+
<div class="faq-grid">
|
| 791 |
+
<details class="faq-item" open>
|
| 792 |
+
<summary class="faq-summary">How do I generate quote stickers using the REST API?</summary>
|
| 793 |
+
<div class="faq-answer">
|
| 794 |
+
Send an HTTP POST request to <code>https://qc.mangrusdi.my.id/generate</code> with header <code>Content-Type: application/json</code>. Include a <code>messages</code> array containing the sender name, avatar URL, and text message. The server processes the canvas in approximately 1 to 2 seconds and returns the resulting base64 image.
|
| 795 |
+
</div>
|
| 796 |
+
</details>
|
| 797 |
+
|
| 798 |
+
<details class="faq-item">
|
| 799 |
+
<summary class="faq-summary">Which image formats and transparency settings are supported?</summary>
|
| 800 |
+
<div class="faq-answer">
|
| 801 |
+
The API natively supports PNG and WebP. For standard sticker bubbles, PNG preserves complete alpha transparency, making it ready to upload directly as a Telegram sticker. WebP provides smaller payloads for web rendering and mobile bandwidth efficiency.
|
| 802 |
+
</div>
|
| 803 |
+
</details>
|
| 804 |
+
|
| 805 |
+
<details class="faq-item">
|
| 806 |
+
<summary class="faq-summary">Can I supply local avatar pictures without public hosting?</summary>
|
| 807 |
+
<div class="faq-answer">
|
| 808 |
+
Yes. The web customizer includes an upload button that reads your local image file and converts it into a base64 data URI (<code>data:image/png;base64,...</code>). The backend accepts both HTTP image links and base64 data URIs for avatars and attachments.
|
| 809 |
+
</div>
|
| 810 |
+
</details>
|
| 811 |
+
|
| 812 |
+
<details class="faq-item">
|
| 813 |
+
<summary class="faq-summary">Is there a health check endpoint to monitor API uptime?</summary>
|
| 814 |
+
<div class="faq-answer">
|
| 815 |
+
Yes. A simple HTTP GET request to <code>https://qc.mangrusdi.my.id/status</code> returns a JSON object containing operational status, server availability, and uptime duration.
|
| 816 |
+
</div>
|
| 817 |
+
</details>
|
| 818 |
+
</div>
|
| 819 |
+
</section>
|
| 820 |
+
|
| 821 |
+
<!-- Site Footer -->
|
| 822 |
+
<footer class="site-footer">
|
| 823 |
+
<div class="footer-top">
|
| 824 |
+
<div>
|
| 825 |
+
<div class="footer-brand-text">Quote Studio</div>
|
| 826 |
+
<p class="footer-sub">Open-Source Telegram Quote Generator & REST API Engine</p>
|
| 827 |
+
</div>
|
| 828 |
+
|
| 829 |
+
<div class="footer-links">
|
| 830 |
+
<a href="#studio" class="footer-link">Customizer</a>
|
| 831 |
+
<a href="#api-docs" class="footer-link">Documentation</a>
|
| 832 |
+
<a href="#specs" class="footer-link">Layout Formats</a>
|
| 833 |
+
<a href="#faq" class="footer-link">FAQ</a>
|
| 834 |
+
<a href="https://github.com/RusdiEneri/quote" target="_blank" rel="noopener noreferrer" class="footer-link">GitHub Repo</a>
|
| 835 |
+
<a href="https://huggingface.co/spaces/ilhamdev/quote-api" target="_blank" rel="noopener noreferrer" class="footer-link">Hugging Face Space</a>
|
| 836 |
+
</div>
|
| 837 |
+
</div>
|
| 838 |
+
|
| 839 |
+
<div class="footer-bottom">
|
| 840 |
+
<p>© 2026 Mang Rusdi. Built with Bun, Hono, Node-Canvas, and Vite.</p>
|
| 841 |
+
<p>Licensed under MIT. Open for personal and bot automation projects.</p>
|
| 842 |
+
</div>
|
| 843 |
+
</footer>
|
| 844 |
+
|
| 845 |
<!-- Global Toast Container -->
|
| 846 |
<div id="toast" class="toast hidden" role="alert" aria-live="polite"></div>
|
| 847 |
</div>
|
frontend/middleware.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Vercel Edge Middleware
|
| 3 |
+
* Enables POST requests directly on qc.mangrusdi.my.id (POST /, POST /generate, POST /api)
|
| 4 |
+
* with IP forwarding, status caching, and rate limit shield for Hugging Face Space.
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
const BACKEND_URL = 'https://ilhamdev-quote-api.hf.space';
|
| 8 |
+
|
| 9 |
+
export const config = {
|
| 10 |
+
matcher: ['/', '/generate', '/status', '/api/:path*'],
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
// Edge cache for /status to reduce Hugging Face wakeups and pings
|
| 14 |
+
let cachedStatusBody = null;
|
| 15 |
+
let cachedStatusTime = 0;
|
| 16 |
+
const STATUS_CACHE_TTL_MS = 15000; // 15 seconds
|
| 17 |
+
|
| 18 |
+
// Edge rate limiting: max 35 POST requests per minute per IP
|
| 19 |
+
const edgeRateLimits = new Map();
|
| 20 |
+
const RATE_WINDOW_MS = 60000;
|
| 21 |
+
const MAX_EDGE_REQUESTS = 35;
|
| 22 |
+
|
| 23 |
+
function isEdgeRateLimited(ip) {
|
| 24 |
+
if (!ip) return false;
|
| 25 |
+
const now = Date.now();
|
| 26 |
+
let history = edgeRateLimits.get(ip) || [];
|
| 27 |
+
history = history.filter(t => now - t < RATE_WINDOW_MS);
|
| 28 |
+
if (history.length >= MAX_EDGE_REQUESTS) {
|
| 29 |
+
edgeRateLimits.set(ip, history);
|
| 30 |
+
return true;
|
| 31 |
+
}
|
| 32 |
+
history.push(now);
|
| 33 |
+
edgeRateLimits.set(ip, history);
|
| 34 |
+
return false;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
export default async function middleware(request) {
|
| 38 |
+
const url = new URL(request.url);
|
| 39 |
+
const clientIp = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ||
|
| 40 |
+
request.headers.get('x-real-ip') ||
|
| 41 |
+
'anonymous';
|
| 42 |
+
|
| 43 |
+
// 1. CORS Preflight Support
|
| 44 |
+
if (request.method === 'OPTIONS') {
|
| 45 |
+
return new Response(null, {
|
| 46 |
+
status: 204,
|
| 47 |
+
headers: {
|
| 48 |
+
'Access-Control-Allow-Origin': '*',
|
| 49 |
+
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
| 50 |
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-Requested-With',
|
| 51 |
+
},
|
| 52 |
+
});
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// 2. Health Check (/status or /api/status) with Edge Caching
|
| 56 |
+
if (url.pathname === '/status' || url.pathname === '/api/status') {
|
| 57 |
+
const now = Date.now();
|
| 58 |
+
if (cachedStatusBody && (now - cachedStatusTime) < STATUS_CACHE_TTL_MS) {
|
| 59 |
+
return new Response(cachedStatusBody, {
|
| 60 |
+
status: 200,
|
| 61 |
+
headers: {
|
| 62 |
+
'Content-Type': 'application/json',
|
| 63 |
+
'Access-Control-Allow-Origin': '*',
|
| 64 |
+
'X-Edge-Cache': 'HIT',
|
| 65 |
+
},
|
| 66 |
+
});
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
try {
|
| 70 |
+
const res = await fetch(`${BACKEND_URL}/status`);
|
| 71 |
+
const body = await res.text();
|
| 72 |
+
if (res.ok) {
|
| 73 |
+
cachedStatusBody = body;
|
| 74 |
+
cachedStatusTime = now;
|
| 75 |
+
}
|
| 76 |
+
return new Response(body, {
|
| 77 |
+
status: res.status,
|
| 78 |
+
headers: {
|
| 79 |
+
'Content-Type': 'application/json',
|
| 80 |
+
'Access-Control-Allow-Origin': '*',
|
| 81 |
+
'X-Edge-Cache': 'MISS',
|
| 82 |
+
},
|
| 83 |
+
});
|
| 84 |
+
} catch (err) {
|
| 85 |
+
return new Response(JSON.stringify({ status: false, message: 'Backend unreachable' }), {
|
| 86 |
+
status: 502,
|
| 87 |
+
headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' },
|
| 88 |
+
});
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// 3. Direct POST Requests (e.g. POST /, POST /generate, POST /api/generate)
|
| 93 |
+
if (request.method === 'POST') {
|
| 94 |
+
// Edge Rate Limiting Shield
|
| 95 |
+
if (isEdgeRateLimited(clientIp)) {
|
| 96 |
+
return new Response(
|
| 97 |
+
JSON.stringify({
|
| 98 |
+
status: false,
|
| 99 |
+
message: 'Rate limit exceeded (35 req/min). Hugging Face Space capacity protection active.',
|
| 100 |
+
retryAfter: 60,
|
| 101 |
+
}),
|
| 102 |
+
{
|
| 103 |
+
status: 429,
|
| 104 |
+
headers: {
|
| 105 |
+
'Content-Type': 'application/json',
|
| 106 |
+
'Access-Control-Allow-Origin': '*',
|
| 107 |
+
'Retry-After': '60',
|
| 108 |
+
},
|
| 109 |
+
}
|
| 110 |
+
);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
try {
|
| 114 |
+
const requestBody = await request.text();
|
| 115 |
+
const headers = new Headers();
|
| 116 |
+
headers.set('Content-Type', request.headers.get('content-type') || 'application/json');
|
| 117 |
+
headers.set('x-forwarded-for', request.headers.get('x-forwarded-for') || clientIp);
|
| 118 |
+
headers.set('x-real-ip', clientIp);
|
| 119 |
+
|
| 120 |
+
const response = await fetch(`${BACKEND_URL}/`, {
|
| 121 |
+
method: 'POST',
|
| 122 |
+
headers: headers,
|
| 123 |
+
body: requestBody,
|
| 124 |
+
});
|
| 125 |
+
|
| 126 |
+
const responseData = await response.text();
|
| 127 |
+
|
| 128 |
+
return new Response(responseData, {
|
| 129 |
+
status: response.status,
|
| 130 |
+
headers: {
|
| 131 |
+
'Content-Type': 'application/json',
|
| 132 |
+
'Access-Control-Allow-Origin': '*',
|
| 133 |
+
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
| 134 |
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
| 135 |
+
'Cache-Control': response.headers.get('cache-control') || 'public, max-age=1800',
|
| 136 |
+
},
|
| 137 |
+
});
|
| 138 |
+
} catch (err) {
|
| 139 |
+
return new Response(JSON.stringify({ status: false, message: `Proxy error: ${err.message}` }), {
|
| 140 |
+
status: 502,
|
| 141 |
+
headers: {
|
| 142 |
+
'Content-Type': 'application/json',
|
| 143 |
+
'Access-Control-Allow-Origin': '*',
|
| 144 |
+
},
|
| 145 |
+
});
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
// 4. Default: Let Vercel serve the static Vite Web App for GET /
|
| 150 |
+
}
|
frontend/public/favicon.png
CHANGED
|
|
Git LFS Details
|
|
|
Git LFS Details
|
frontend/public/og-image.png
ADDED
|
Git LFS Details
|
frontend/public/robots.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
User-agent: *
|
| 2 |
+
Allow: /
|
| 3 |
+
|
| 4 |
+
Sitemap: https://qc.mangrusdi.my.id/sitemap.xml
|
frontend/public/sitemap.xml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
| 3 |
+
<url>
|
| 4 |
+
<loc>https://qc.mangrusdi.my.id/</loc>
|
| 5 |
+
<lastmod>2026-10-08</lastmod>
|
| 6 |
+
<changefreq>weekly</changefreq>
|
| 7 |
+
<priority>1.0</priority>
|
| 8 |
+
</url>
|
| 9 |
+
<url>
|
| 10 |
+
<loc>https://qc.mangrusdi.my.id/generate</loc>
|
| 11 |
+
<lastmod>2026-10-08</lastmod>
|
| 12 |
+
<changefreq>monthly</changefreq>
|
| 13 |
+
<priority>0.8</priority>
|
| 14 |
+
</url>
|
| 15 |
+
<url>
|
| 16 |
+
<loc>https://qc.mangrusdi.my.id/status</loc>
|
| 17 |
+
<lastmod>2026-10-08</lastmod>
|
| 18 |
+
<changefreq>monthly</changefreq>
|
| 19 |
+
<priority>0.5</priority>
|
| 20 |
+
</url>
|
| 21 |
+
</urlset>
|
frontend/src/main.js
CHANGED
|
@@ -4,9 +4,15 @@
|
|
| 4 |
*/
|
| 5 |
|
| 6 |
// API Configuration
|
| 7 |
-
|
| 8 |
-
const
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
// DOM Elements
|
| 12 |
const form = document.getElementById('quoteForm');
|
|
@@ -55,14 +61,48 @@ const copyImageBtn = document.getElementById('copyImageBtn');
|
|
| 55 |
const apiStatusBadge = document.getElementById('apiStatusBadge');
|
| 56 |
const apiStatusText = document.getElementById('apiStatusText');
|
| 57 |
const toastEl = document.getElementById('toast');
|
|
|
|
|
|
|
| 58 |
|
| 59 |
// Code Playground Elements
|
| 60 |
const codeSnippet = document.getElementById('codeSnippet');
|
| 61 |
const copySnippetBtn = document.getElementById('copySnippetBtn');
|
| 62 |
const tabButtons = document.querySelectorAll('.tab-btn');
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
let currentTab = 'curl';
|
| 65 |
let currentGeneratedBlob = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
// Initialize Timestamp
|
| 68 |
function updateTimestamp() {
|
|
@@ -87,20 +127,19 @@ async function checkApiStatus() {
|
|
| 87 |
try {
|
| 88 |
const controller = new AbortController();
|
| 89 |
const timeout = setTimeout(() => controller.abort(), 6000);
|
| 90 |
-
|
| 91 |
-
// Try direct HF Space first (CORS enabled), then proxy
|
| 92 |
let res;
|
| 93 |
try {
|
| 94 |
-
res = await fetch(
|
| 95 |
} catch {
|
| 96 |
-
//
|
| 97 |
}
|
| 98 |
|
| 99 |
if (!res || !res.ok) {
|
| 100 |
try {
|
| 101 |
-
res = await fetch(
|
| 102 |
} catch {
|
| 103 |
-
//
|
| 104 |
}
|
| 105 |
}
|
| 106 |
clearTimeout(timeout);
|
|
@@ -174,18 +213,26 @@ function updateLivePreview() {
|
|
| 174 |
prevMessageText.textContent = text;
|
| 175 |
|
| 176 |
// Mode Tag & Watermark visibility
|
|
|
|
| 177 |
if (type === 'stories') {
|
| 178 |
previewModeTag.textContent = 'Stories Mode (9:16)';
|
| 179 |
watermarkGroup.style.display = 'flex';
|
| 180 |
previewStage.style.minHeight = '320px';
|
|
|
|
| 181 |
} else if (type === 'image') {
|
| 182 |
previewModeTag.textContent = 'Image Mode';
|
| 183 |
watermarkGroup.style.display = 'flex';
|
| 184 |
previewStage.style.minHeight = '240px';
|
|
|
|
| 185 |
} else {
|
| 186 |
previewModeTag.textContent = 'Quote Mode';
|
| 187 |
watermarkGroup.style.display = 'none';
|
| 188 |
previewStage.style.minHeight = '200px';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
}
|
| 190 |
|
| 191 |
// Update Code Snippets
|
|
@@ -252,13 +299,14 @@ function buildApiPayload() {
|
|
| 252 |
function updateCodeSnippets() {
|
| 253 |
const payload = buildApiPayload();
|
| 254 |
const jsonString = JSON.stringify(payload, null, 2);
|
|
|
|
| 255 |
|
| 256 |
if (currentTab === 'curl') {
|
| 257 |
-
codeSnippet.textContent = `curl -X POST "${
|
| 258 |
-H "Content-Type: application/json" \\
|
| 259 |
-
-d '${
|
| 260 |
} else if (currentTab === 'js') {
|
| 261 |
-
codeSnippet.textContent = `const response = await fetch('${
|
| 262 |
method: 'POST',
|
| 263 |
headers: { 'Content-Type': 'application/json' },
|
| 264 |
body: JSON.stringify(${jsonString})
|
|
@@ -269,7 +317,7 @@ const imageBase64 = data.image; // data:image/png;base64,...`;
|
|
| 269 |
} else if (currentTab === 'py') {
|
| 270 |
codeSnippet.textContent = `import requests
|
| 271 |
|
| 272 |
-
url = "${
|
| 273 |
payload = ${JSON.stringify(payload, null, 4)}
|
| 274 |
|
| 275 |
response = requests.post(url, json=payload)
|
|
@@ -278,6 +326,30 @@ image_base64 = data["image"]`;
|
|
| 278 |
}
|
| 279 |
}
|
| 280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
// Generate Quote via Backend API
|
| 282 |
async function generateQuote() {
|
| 283 |
const text = messageTextInput.value.trim();
|
|
@@ -295,50 +367,87 @@ async function generateQuote() {
|
|
| 295 |
return;
|
| 296 |
}
|
| 297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
// Set Loading State
|
| 299 |
generateBtn.disabled = true;
|
| 300 |
const originalContent = generateBtn.innerHTML;
|
| 301 |
generateBtn.innerHTML = `
|
| 302 |
<span class="btn-icon">
|
| 303 |
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="spin">
|
| 304 |
<circle cx="12" cy="12" r="10" stroke-opacity="0.25"></circle>
|
| 305 |
<path d="M12 2a10 10 0 0 1 10 10"></path>
|
| 306 |
</svg>
|
| 307 |
</span>
|
| 308 |
-
<span>Generating via
|
| 309 |
`;
|
| 310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
const payload = buildApiPayload();
|
| 312 |
|
| 313 |
const controller = new AbortController();
|
| 314 |
-
const timeoutTimer = setTimeout(() => controller.abort(),
|
| 315 |
|
| 316 |
try {
|
| 317 |
let response;
|
| 318 |
-
// Attempt request to
|
| 319 |
try {
|
| 320 |
-
response = await fetch(
|
| 321 |
method: 'POST',
|
| 322 |
headers: { 'Content-Type': 'application/json' },
|
| 323 |
body: JSON.stringify(payload),
|
| 324 |
signal: controller.signal,
|
| 325 |
});
|
| 326 |
-
} catch (
|
| 327 |
-
if (
|
| 328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
}
|
| 330 |
-
response = await fetch(PROXY_URL, {
|
| 331 |
-
method: 'POST',
|
| 332 |
-
headers: { 'Content-Type': 'application/json' },
|
| 333 |
-
body: JSON.stringify(payload),
|
| 334 |
-
signal: controller.signal,
|
| 335 |
-
});
|
| 336 |
}
|
| 337 |
|
| 338 |
clearTimeout(timeoutTimer);
|
| 339 |
|
| 340 |
-
if (!response.ok) {
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
}
|
| 343 |
|
| 344 |
const data = await response.json();
|
|
@@ -371,7 +480,7 @@ async function generateQuote() {
|
|
| 371 |
showToast('Quote berhasil digenerate!', 'success');
|
| 372 |
} catch (err) {
|
| 373 |
console.error('Generate Error:', err);
|
| 374 |
-
showToast(`Gagal: ${err.message}
|
| 375 |
} finally {
|
| 376 |
generateBtn.disabled = false;
|
| 377 |
generateBtn.innerHTML = originalContent;
|
|
@@ -406,6 +515,12 @@ function copyCodeSnippet() {
|
|
| 406 |
if (!code) return;
|
| 407 |
navigator.clipboard.writeText(code).then(() => {
|
| 408 |
showToast('Kode snippet disalin!', 'success');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
}).catch(() => {
|
| 410 |
showToast('Gagal menyalin snippet', 'error');
|
| 411 |
});
|
|
@@ -413,6 +528,11 @@ function copyCodeSnippet() {
|
|
| 413 |
|
| 414 |
// Setup Event Listeners
|
| 415 |
function setupEvents() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
// Real-time input updates
|
| 417 |
const inputs = [
|
| 418 |
senderNameInput,
|
|
@@ -462,6 +582,8 @@ function setupEvents() {
|
|
| 462 |
btn.addEventListener('click', () => {
|
| 463 |
const color = btn.dataset.color;
|
| 464 |
if (color) {
|
|
|
|
|
|
|
| 465 |
bgColorInput.value = color;
|
| 466 |
bgColorTextInput.value = color;
|
| 467 |
updateLivePreview();
|
|
@@ -510,6 +632,46 @@ function setupEvents() {
|
|
| 510 |
showToast('Form direset ke default', 'info');
|
| 511 |
});
|
| 512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
// Generate Button
|
| 514 |
generateBtn.addEventListener('click', generateQuote);
|
| 515 |
|
|
@@ -532,6 +694,7 @@ function setupEvents() {
|
|
| 532 |
|
| 533 |
// App Initialization
|
| 534 |
function init() {
|
|
|
|
| 535 |
updateTimestamp();
|
| 536 |
updateLivePreview();
|
| 537 |
setupEvents();
|
|
|
|
| 4 |
*/
|
| 5 |
|
| 6 |
// API Configuration
|
| 7 |
+
// Subdomain Proxy: Direct POST to Vercel subdomain qc.mangrusdi.my.id
|
| 8 |
+
const SUBDOMAIN_URL = typeof window !== 'undefined' && window.location.origin.includes('qc.mangrusdi.my.id')
|
| 9 |
+
? 'https://qc.mangrusdi.my.id'
|
| 10 |
+
: (typeof window !== 'undefined' ? window.location.origin : 'https://qc.mangrusdi.my.id');
|
| 11 |
+
|
| 12 |
+
const HF_BACKEND_URL = 'https://ilhamdev-quote-api.hf.space';
|
| 13 |
+
const PRIMARY_ENDPOINT = '/generate';
|
| 14 |
+
const PROXY_ENDPOINT = '/api/generate';
|
| 15 |
+
const STATUS_ENDPOINT = '/status';
|
| 16 |
|
| 17 |
// DOM Elements
|
| 18 |
const form = document.getElementById('quoteForm');
|
|
|
|
| 61 |
const apiStatusBadge = document.getElementById('apiStatusBadge');
|
| 62 |
const apiStatusText = document.getElementById('apiStatusText');
|
| 63 |
const toastEl = document.getElementById('toast');
|
| 64 |
+
const prevFormatMeta = document.getElementById('prevFormatMeta');
|
| 65 |
+
const prevBgMeta = document.getElementById('prevBgMeta');
|
| 66 |
|
| 67 |
// Code Playground Elements
|
| 68 |
const codeSnippet = document.getElementById('codeSnippet');
|
| 69 |
const copySnippetBtn = document.getElementById('copySnippetBtn');
|
| 70 |
const tabButtons = document.querySelectorAll('.tab-btn');
|
| 71 |
|
| 72 |
+
// Theme Elements
|
| 73 |
+
const themeToggleBtn = document.getElementById('themeToggleBtn');
|
| 74 |
+
const themeIconSun = document.getElementById('themeIconSun');
|
| 75 |
+
const themeIconMoon = document.getElementById('themeIconMoon');
|
| 76 |
+
|
| 77 |
let currentTab = 'curl';
|
| 78 |
let currentGeneratedBlob = null;
|
| 79 |
+
let lastGenerateTime = 0;
|
| 80 |
+
|
| 81 |
+
// Theme Functions
|
| 82 |
+
function initTheme() {
|
| 83 |
+
const saved = localStorage.getItem('qc_theme');
|
| 84 |
+
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 85 |
+
const theme = saved || (prefersDark ? 'dark' : 'light');
|
| 86 |
+
setTheme(theme);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
function setTheme(theme) {
|
| 90 |
+
if (theme === 'dark') {
|
| 91 |
+
document.documentElement.setAttribute('data-theme', 'dark');
|
| 92 |
+
if (themeIconSun) themeIconSun.style.display = 'none';
|
| 93 |
+
if (themeIconMoon) themeIconMoon.style.display = 'block';
|
| 94 |
+
} else {
|
| 95 |
+
document.documentElement.removeAttribute('data-theme');
|
| 96 |
+
if (themeIconSun) themeIconSun.style.display = 'block';
|
| 97 |
+
if (themeIconMoon) themeIconMoon.style.display = 'none';
|
| 98 |
+
}
|
| 99 |
+
localStorage.setItem('qc_theme', theme);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
function toggleTheme() {
|
| 103 |
+
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
| 104 |
+
setTheme(isDark ? 'light' : 'dark');
|
| 105 |
+
}
|
| 106 |
|
| 107 |
// Initialize Timestamp
|
| 108 |
function updateTimestamp() {
|
|
|
|
| 127 |
try {
|
| 128 |
const controller = new AbortController();
|
| 129 |
const timeout = setTimeout(() => controller.abort(), 6000);
|
| 130 |
+
// Check Subdomain Proxy /status first, fallback to HF backend directly
|
|
|
|
| 131 |
let res;
|
| 132 |
try {
|
| 133 |
+
res = await fetch(STATUS_ENDPOINT, { signal: controller.signal });
|
| 134 |
} catch {
|
| 135 |
+
// Subdomain failed, try /api/status or direct HF
|
| 136 |
}
|
| 137 |
|
| 138 |
if (!res || !res.ok) {
|
| 139 |
try {
|
| 140 |
+
res = await fetch(`${HF_BACKEND_URL}/status`, { signal: controller.signal });
|
| 141 |
} catch {
|
| 142 |
+
// Direct HF failed as well
|
| 143 |
}
|
| 144 |
}
|
| 145 |
clearTimeout(timeout);
|
|
|
|
| 213 |
prevMessageText.textContent = text;
|
| 214 |
|
| 215 |
// Mode Tag & Watermark visibility
|
| 216 |
+
const fmt = (imageFormatSelect.value || 'png').toUpperCase();
|
| 217 |
if (type === 'stories') {
|
| 218 |
previewModeTag.textContent = 'Stories Mode (9:16)';
|
| 219 |
watermarkGroup.style.display = 'flex';
|
| 220 |
previewStage.style.minHeight = '320px';
|
| 221 |
+
if (prevFormatMeta) prevFormatMeta.textContent = `${fmt} (1080×1920) • Stories 9:16`;
|
| 222 |
} else if (type === 'image') {
|
| 223 |
previewModeTag.textContent = 'Image Mode';
|
| 224 |
watermarkGroup.style.display = 'flex';
|
| 225 |
previewStage.style.minHeight = '240px';
|
| 226 |
+
if (prevFormatMeta) prevFormatMeta.textContent = `${fmt} (1280×720) • Canvas`;
|
| 227 |
} else {
|
| 228 |
previewModeTag.textContent = 'Quote Mode';
|
| 229 |
watermarkGroup.style.display = 'none';
|
| 230 |
previewStage.style.minHeight = '200px';
|
| 231 |
+
if (prevFormatMeta) prevFormatMeta.textContent = `${fmt} (512px max) • Sticker`;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
if (prevBgMeta) {
|
| 235 |
+
prevBgMeta.textContent = bgColor.toUpperCase();
|
| 236 |
}
|
| 237 |
|
| 238 |
// Update Code Snippets
|
|
|
|
| 299 |
function updateCodeSnippets() {
|
| 300 |
const payload = buildApiPayload();
|
| 301 |
const jsonString = JSON.stringify(payload, null, 2);
|
| 302 |
+
const targetApiUrl = `${SUBDOMAIN_URL}${PRIMARY_ENDPOINT}`;
|
| 303 |
|
| 304 |
if (currentTab === 'curl') {
|
| 305 |
+
codeSnippet.textContent = `curl -X POST "${targetApiUrl}" \\
|
| 306 |
-H "Content-Type: application/json" \\
|
| 307 |
+
-d '${jsonString}'`;
|
| 308 |
} else if (currentTab === 'js') {
|
| 309 |
+
codeSnippet.textContent = `const response = await fetch('${targetApiUrl}', {
|
| 310 |
method: 'POST',
|
| 311 |
headers: { 'Content-Type': 'application/json' },
|
| 312 |
body: JSON.stringify(${jsonString})
|
|
|
|
| 317 |
} else if (currentTab === 'py') {
|
| 318 |
codeSnippet.textContent = `import requests
|
| 319 |
|
| 320 |
+
url = "${targetApiUrl}"
|
| 321 |
payload = ${JSON.stringify(payload, null, 4)}
|
| 322 |
|
| 323 |
response = requests.post(url, json=payload)
|
|
|
|
| 326 |
}
|
| 327 |
}
|
| 328 |
|
| 329 |
+
// Switch Mobile Studio Tabs (Customizer vs Live Preview)
|
| 330 |
+
function switchMobileTab(target) {
|
| 331 |
+
const tabEditorBtn = document.getElementById('tabEditorBtn');
|
| 332 |
+
const tabPreviewBtn = document.getElementById('tabPreviewBtn');
|
| 333 |
+
const editorPanel = document.getElementById('editorPanel');
|
| 334 |
+
const previewPanel = document.getElementById('previewPanel');
|
| 335 |
+
|
| 336 |
+
if (target === 'editor') {
|
| 337 |
+
tabEditorBtn?.classList.add('active');
|
| 338 |
+
tabEditorBtn?.setAttribute('aria-selected', 'true');
|
| 339 |
+
tabPreviewBtn?.classList.remove('active');
|
| 340 |
+
tabPreviewBtn?.setAttribute('aria-selected', 'false');
|
| 341 |
+
editorPanel?.classList.add('active-mobile-view');
|
| 342 |
+
previewPanel?.classList.remove('active-mobile-view');
|
| 343 |
+
} else {
|
| 344 |
+
tabPreviewBtn?.classList.add('active');
|
| 345 |
+
tabPreviewBtn?.setAttribute('aria-selected', 'true');
|
| 346 |
+
tabEditorBtn?.classList.remove('active');
|
| 347 |
+
tabEditorBtn?.setAttribute('aria-selected', 'false');
|
| 348 |
+
previewPanel?.classList.add('active-mobile-view');
|
| 349 |
+
editorPanel?.classList.remove('active-mobile-view');
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
// Generate Quote via Backend API
|
| 354 |
async function generateQuote() {
|
| 355 |
const text = messageTextInput.value.trim();
|
|
|
|
| 367 |
return;
|
| 368 |
}
|
| 369 |
|
| 370 |
+
// Client-side Cooldown Protection against Spam
|
| 371 |
+
const now = Date.now();
|
| 372 |
+
if (now - lastGenerateTime < 1500) {
|
| 373 |
+
showToast('Tunggu sebentar sebelum mengenerate kembali.', 'info');
|
| 374 |
+
return;
|
| 375 |
+
}
|
| 376 |
+
lastGenerateTime = now;
|
| 377 |
+
|
| 378 |
// Set Loading State
|
| 379 |
generateBtn.disabled = true;
|
| 380 |
const originalContent = generateBtn.innerHTML;
|
| 381 |
generateBtn.innerHTML = `
|
| 382 |
<span class="btn-icon">
|
| 383 |
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" class="spin">
|
| 384 |
<circle cx="12" cy="12" r="10" stroke-opacity="0.25"></circle>
|
| 385 |
<path d="M12 2a10 10 0 0 1 10 10"></path>
|
| 386 |
</svg>
|
| 387 |
</span>
|
| 388 |
+
<span>Generating via Subdomain Proxy...</span>
|
| 389 |
`;
|
| 390 |
|
| 391 |
+
// On mobile screens, automatically switch to Preview tab so user sees loading & generated result
|
| 392 |
+
if (window.innerWidth <= 960) {
|
| 393 |
+
switchMobileTab('preview');
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
const payload = buildApiPayload();
|
| 397 |
|
| 398 |
const controller = new AbortController();
|
| 399 |
+
const timeoutTimer = setTimeout(() => controller.abort(), 35000);
|
| 400 |
|
| 401 |
try {
|
| 402 |
let response;
|
| 403 |
+
// Attempt request to Subdomain /generate first, then /api/generate, then direct HF
|
| 404 |
try {
|
| 405 |
+
response = await fetch(PRIMARY_ENDPOINT, {
|
| 406 |
method: 'POST',
|
| 407 |
headers: { 'Content-Type': 'application/json' },
|
| 408 |
body: JSON.stringify(payload),
|
| 409 |
signal: controller.signal,
|
| 410 |
});
|
| 411 |
+
} catch (e1) {
|
| 412 |
+
if (e1.name === 'AbortError') throw new Error('Request timeout setelah 35 detik');
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
if (!response || !response.ok) {
|
| 416 |
+
try {
|
| 417 |
+
response = await fetch(PROXY_ENDPOINT, {
|
| 418 |
+
method: 'POST',
|
| 419 |
+
headers: { 'Content-Type': 'application/json' },
|
| 420 |
+
body: JSON.stringify(payload),
|
| 421 |
+
signal: controller.signal,
|
| 422 |
+
});
|
| 423 |
+
} catch (e2) {
|
| 424 |
+
if (e2.name === 'AbortError') throw new Error('Request timeout setelah 35 detik');
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
if (!response || !response.ok) {
|
| 429 |
+
try {
|
| 430 |
+
response = await fetch(`${HF_BACKEND_URL}/`, {
|
| 431 |
+
method: 'POST',
|
| 432 |
+
headers: { 'Content-Type': 'application/json' },
|
| 433 |
+
body: JSON.stringify(payload),
|
| 434 |
+
signal: controller.signal,
|
| 435 |
+
});
|
| 436 |
+
} catch (e3) {
|
| 437 |
+
if (e3.name === 'AbortError') throw new Error('Request timeout setelah 35 detik');
|
| 438 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
}
|
| 440 |
|
| 441 |
clearTimeout(timeoutTimer);
|
| 442 |
|
| 443 |
+
if (!response || !response.ok) {
|
| 444 |
+
if (response && response.status === 429) {
|
| 445 |
+
throw new Error('Batas permintaan (Rate Limit 30 req/min) tercapai untuk mengamankan kuota Hugging Face Space. Harap tunggu sebentar.');
|
| 446 |
+
}
|
| 447 |
+
if (response && response.status === 503) {
|
| 448 |
+
throw new Error('Server rendering sedang sibuk menangani antrean grafis. Coba lagi dalam beberapa detik.');
|
| 449 |
+
}
|
| 450 |
+
throw new Error(`Server returned HTTP ${response ? response.status : 'offline'}`);
|
| 451 |
}
|
| 452 |
|
| 453 |
const data = await response.json();
|
|
|
|
| 480 |
showToast('Quote berhasil digenerate!', 'success');
|
| 481 |
} catch (err) {
|
| 482 |
console.error('Generate Error:', err);
|
| 483 |
+
showToast(`Gagal: ${err.message}`, 'error', 6000);
|
| 484 |
} finally {
|
| 485 |
generateBtn.disabled = false;
|
| 486 |
generateBtn.innerHTML = originalContent;
|
|
|
|
| 515 |
if (!code) return;
|
| 516 |
navigator.clipboard.writeText(code).then(() => {
|
| 517 |
showToast('Kode snippet disalin!', 'success');
|
| 518 |
+
const label = copySnippetBtn.querySelector('.copy-label') || copySnippetBtn.querySelector('span');
|
| 519 |
+
if (label) {
|
| 520 |
+
const prev = label.textContent;
|
| 521 |
+
label.textContent = 'Copied!';
|
| 522 |
+
setTimeout(() => { label.textContent = prev; }, 2000);
|
| 523 |
+
}
|
| 524 |
}).catch(() => {
|
| 525 |
showToast('Gagal menyalin snippet', 'error');
|
| 526 |
});
|
|
|
|
| 528 |
|
| 529 |
// Setup Event Listeners
|
| 530 |
function setupEvents() {
|
| 531 |
+
// Theme Toggle
|
| 532 |
+
if (themeToggleBtn) {
|
| 533 |
+
themeToggleBtn.addEventListener('click', toggleTheme);
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
// Real-time input updates
|
| 537 |
const inputs = [
|
| 538 |
senderNameInput,
|
|
|
|
| 582 |
btn.addEventListener('click', () => {
|
| 583 |
const color = btn.dataset.color;
|
| 584 |
if (color) {
|
| 585 |
+
document.querySelectorAll('.palette-btn').forEach(b => b.classList.remove('active'));
|
| 586 |
+
btn.classList.add('active');
|
| 587 |
bgColorInput.value = color;
|
| 588 |
bgColorTextInput.value = color;
|
| 589 |
updateLivePreview();
|
|
|
|
| 632 |
showToast('Form direset ke default', 'info');
|
| 633 |
});
|
| 634 |
|
| 635 |
+
// Mobile menu toggle
|
| 636 |
+
const mobileMenuBtn = document.getElementById('mobileMenuBtn');
|
| 637 |
+
const navLinks = document.querySelector('.nav-links');
|
| 638 |
+
if (mobileMenuBtn && navLinks) {
|
| 639 |
+
mobileMenuBtn.addEventListener('click', (e) => {
|
| 640 |
+
e.stopPropagation();
|
| 641 |
+
const isOpen = navLinks.classList.toggle('open');
|
| 642 |
+
mobileMenuBtn.setAttribute('aria-expanded', String(isOpen));
|
| 643 |
+
});
|
| 644 |
+
|
| 645 |
+
navLinks.querySelectorAll('.nav-anchor').forEach(link => {
|
| 646 |
+
link.addEventListener('click', () => {
|
| 647 |
+
navLinks.classList.remove('open');
|
| 648 |
+
mobileMenuBtn.setAttribute('aria-expanded', 'false');
|
| 649 |
+
});
|
| 650 |
+
});
|
| 651 |
+
|
| 652 |
+
document.addEventListener('click', (e) => {
|
| 653 |
+
if (!navLinks.contains(e.target) && !mobileMenuBtn.contains(e.target)) {
|
| 654 |
+
navLinks.classList.remove('open');
|
| 655 |
+
mobileMenuBtn.setAttribute('aria-expanded', 'false');
|
| 656 |
+
}
|
| 657 |
+
});
|
| 658 |
+
|
| 659 |
+
document.addEventListener('keydown', (e) => {
|
| 660 |
+
if (e.key === 'Escape') {
|
| 661 |
+
navLinks.classList.remove('open');
|
| 662 |
+
mobileMenuBtn.setAttribute('aria-expanded', 'false');
|
| 663 |
+
}
|
| 664 |
+
});
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
// Mobile Studio Switcher Tabs
|
| 668 |
+
const tabEditorBtn = document.getElementById('tabEditorBtn');
|
| 669 |
+
const tabPreviewBtn = document.getElementById('tabPreviewBtn');
|
| 670 |
+
if (tabEditorBtn && tabPreviewBtn) {
|
| 671 |
+
tabEditorBtn.addEventListener('click', () => switchMobileTab('editor'));
|
| 672 |
+
tabPreviewBtn.addEventListener('click', () => switchMobileTab('preview'));
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
// Generate Button
|
| 676 |
generateBtn.addEventListener('click', generateQuote);
|
| 677 |
|
|
|
|
| 694 |
|
| 695 |
// App Initialization
|
| 696 |
function init() {
|
| 697 |
+
initTheme();
|
| 698 |
updateTimestamp();
|
| 699 |
updateLivePreview();
|
| 700 |
setupEvents();
|
frontend/src/styles/base.css
CHANGED
|
@@ -1,44 +1,83 @@
|
|
| 1 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
:root {
|
| 3 |
-
--font-sans:
|
| 4 |
-
--font-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
/*
|
| 8 |
-
--
|
| 9 |
-
--
|
| 10 |
-
--
|
| 11 |
-
--
|
| 12 |
-
--
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
--
|
| 17 |
-
|
| 18 |
-
--
|
| 19 |
-
--
|
| 20 |
-
--
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
--
|
| 24 |
-
--
|
| 25 |
-
--
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
--
|
| 29 |
-
--
|
| 30 |
-
--
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
--radius-sm: 6px;
|
| 33 |
-
--radius-md:
|
| 34 |
-
--radius-lg:
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
--
|
| 38 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
-
/*
|
| 42 |
*,
|
| 43 |
*::before,
|
| 44 |
*::after {
|
|
@@ -47,89 +86,523 @@
|
|
| 47 |
padding: 0;
|
| 48 |
}
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
body {
|
| 51 |
font-family: var(--font-sans);
|
| 52 |
-
background-color: var(--bg-
|
| 53 |
color: var(--text-primary);
|
| 54 |
min-height: 100vh;
|
| 55 |
-
|
|
|
|
| 56 |
-webkit-font-smoothing: antialiased;
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
background-
|
| 61 |
}
|
| 62 |
|
| 63 |
-
/* Layout */
|
| 64 |
.app-layout {
|
| 65 |
display: flex;
|
| 66 |
flex-direction: column;
|
| 67 |
min-height: 100vh;
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
margin: 0 auto;
|
| 70 |
-
padding: 0 1.5rem
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
-
/*
|
|
|
|
|
|
|
| 74 |
.navbar {
|
| 75 |
display: flex;
|
| 76 |
align-items: center;
|
| 77 |
justify-content: space-between;
|
| 78 |
padding: 1.25rem 0;
|
| 79 |
-
border-bottom:
|
| 80 |
margin-bottom: 2rem;
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
.brand {
|
| 84 |
display: flex;
|
| 85 |
align-items: center;
|
| 86 |
gap: 0.85rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
}
|
| 88 |
|
| 89 |
-
.brand-
|
| 90 |
-
display: flex;
|
| 91 |
-
align-items: center;
|
| 92 |
-
justify-content: center;
|
| 93 |
width: 44px;
|
| 94 |
height: 44px;
|
| 95 |
-
border-radius: var(--radius-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
}
|
| 100 |
|
| 101 |
.brand-title {
|
| 102 |
-
font-
|
| 103 |
-
font-
|
| 104 |
-
|
| 105 |
-
letter-spacing: -0.
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
|
| 111 |
.brand-sub {
|
| 112 |
-
font-size: 0.
|
|
|
|
| 113 |
color: var(--text-muted);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
.nav-actions {
|
| 117 |
display: flex;
|
| 118 |
align-items: center;
|
| 119 |
-
gap:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
}
|
| 121 |
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
.studio-container {
|
| 124 |
display: grid;
|
| 125 |
-
grid-template-columns: 1.15fr 1fr;
|
| 126 |
-
gap:
|
| 127 |
align-items: start;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
@media (max-width: 960px) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
.studio-container {
|
| 132 |
-
grid-template-columns: 1fr;
|
| 133 |
-
gap: 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
}
|
|
|
|
| 1 |
+
/* ==========================================================================
|
| 2 |
+
NEUBRUTALISM DESIGN SYSTEM - BASE.CSS
|
| 3 |
+
Based on DESIGN.md: Bold, Colorful, Raw, Playful, High-Contrast
|
| 4 |
+
========================================================================== */
|
| 5 |
+
|
| 6 |
:root {
|
| 7 |
+
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
| 8 |
+
--font-mono: 'JetBrains Mono', 'SF Mono', Consolas, Menlo, monospace;
|
| 9 |
+
|
| 10 |
+
/* Neubrutalism Core Palette */
|
| 11 |
+
--color-primary: #FFEB3B; /* Signature Yellow */
|
| 12 |
+
--color-secondary: #FF5252; /* Coral Red */
|
| 13 |
+
--color-tertiary: #2196F3; /* Electric Blue */
|
| 14 |
+
--color-accent-green: #00E676; /* Neubrutal Green */
|
| 15 |
+
--color-black: #000000;
|
| 16 |
+
--color-charcoal: #1a1a1a;
|
| 17 |
+
--color-white: #ffffff;
|
| 18 |
+
|
| 19 |
+
/* Light Theme (Default Neubrutalism) */
|
| 20 |
+
--bg-page: #FFFDF0; /* Warm Cream Paper Base */
|
| 21 |
+
--bg-card: #ffffff; /* Pure White Surface */
|
| 22 |
+
--bg-card-hover: #FFFBEA;
|
| 23 |
+
--bg-nested: #FFF9E6; /* Subtle Warm Tint */
|
| 24 |
+
--bg-input: #ffffff;
|
| 25 |
+
--bg-stage: #1e242d; /* Neutral Stage for Telegram Bubble */
|
| 26 |
+
|
| 27 |
+
--text-primary: #000000;
|
| 28 |
+
--text-secondary: #242424;
|
| 29 |
+
--text-muted: #595959;
|
| 30 |
+
|
| 31 |
+
--border-color: #000000;
|
| 32 |
+
--border-width-sm: 2px;
|
| 33 |
+
--border-width-md: 3px;
|
| 34 |
+
--border-width-lg: 4px;
|
| 35 |
|
| 36 |
+
--border-sm: var(--border-width-sm) solid var(--border-color);
|
| 37 |
+
--border-md: var(--border-width-md) solid var(--border-color);
|
| 38 |
+
--border-lg: var(--border-width-lg) solid var(--border-color);
|
| 39 |
+
|
| 40 |
+
/* Hard 45deg Offset Drop Shadows (No Soft Blurs) */
|
| 41 |
+
--shadow-color: #000000;
|
| 42 |
+
--shadow-sm: 2px 2px 0px var(--shadow-color);
|
| 43 |
+
--shadow-md: 4px 4px 0px var(--shadow-color);
|
| 44 |
+
--shadow-lg: 6px 6px 0px var(--shadow-color);
|
| 45 |
+
--shadow-xl: 8px 8px 0px var(--shadow-color);
|
| 46 |
+
|
| 47 |
+
--radius-xs: 4px;
|
| 48 |
--radius-sm: 6px;
|
| 49 |
+
--radius-md: 8px; /* Base Corner Radius from DESIGN.md */
|
| 50 |
+
--radius-lg: 10px;
|
| 51 |
+
|
| 52 |
+
--transition-tactile: 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/* Dark Neubrutalism Theme */
|
| 56 |
+
[data-theme="dark"] {
|
| 57 |
+
--bg-page: #121212;
|
| 58 |
+
--bg-card: #1c1c1c;
|
| 59 |
+
--bg-card-hover: #242424;
|
| 60 |
+
--bg-nested: #222222;
|
| 61 |
+
--bg-input: #151515;
|
| 62 |
+
--bg-stage: #15181e;
|
| 63 |
|
| 64 |
+
--text-primary: #ffffff;
|
| 65 |
+
--text-secondary: #e6e6e6;
|
| 66 |
+
--text-muted: #aaaaaa;
|
| 67 |
+
|
| 68 |
+
--border-color: #ffffff;
|
| 69 |
+
--border-sm: var(--border-width-sm) solid var(--border-color);
|
| 70 |
+
--border-md: var(--border-width-md) solid var(--border-color);
|
| 71 |
+
--border-lg: var(--border-width-lg) solid var(--border-color);
|
| 72 |
+
|
| 73 |
+
--shadow-color: #FFEB3B; /* Neon Yellow Hard Shadow in Dark Mode */
|
| 74 |
+
--shadow-sm: 2px 2px 0px var(--shadow-color);
|
| 75 |
+
--shadow-md: 4px 4px 0px var(--shadow-color);
|
| 76 |
+
--shadow-lg: 6px 6px 0px var(--shadow-color);
|
| 77 |
+
--shadow-xl: 8px 8px 0px var(--shadow-color);
|
| 78 |
}
|
| 79 |
|
| 80 |
+
/* Global Reset */
|
| 81 |
*,
|
| 82 |
*::before,
|
| 83 |
*::after {
|
|
|
|
| 86 |
padding: 0;
|
| 87 |
}
|
| 88 |
|
| 89 |
+
html {
|
| 90 |
+
scroll-behavior: smooth;
|
| 91 |
+
font-size: 16px;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
body {
|
| 95 |
font-family: var(--font-sans);
|
| 96 |
+
background-color: var(--bg-page);
|
| 97 |
color: var(--text-primary);
|
| 98 |
min-height: 100vh;
|
| 99 |
+
min-height: 100dvh;
|
| 100 |
+
line-height: 1.6;
|
| 101 |
-webkit-font-smoothing: antialiased;
|
| 102 |
+
-moz-osx-font-smoothing: grayscale;
|
| 103 |
+
overflow-x: hidden;
|
| 104 |
+
width: 100%;
|
| 105 |
+
transition: background-color var(--transition-tactile), color var(--transition-tactile);
|
| 106 |
}
|
| 107 |
|
| 108 |
+
/* Layout Container */
|
| 109 |
.app-layout {
|
| 110 |
display: flex;
|
| 111 |
flex-direction: column;
|
| 112 |
min-height: 100vh;
|
| 113 |
+
min-height: 100dvh;
|
| 114 |
+
max-width: 1280px;
|
| 115 |
+
width: 100%;
|
| 116 |
margin: 0 auto;
|
| 117 |
+
padding: 0 1.5rem 3rem;
|
| 118 |
+
overflow-x: hidden;
|
| 119 |
}
|
| 120 |
|
| 121 |
+
/* ==========================================================================
|
| 122 |
+
NAVBAR (NEUBRUTALISM HEADER)
|
| 123 |
+
========================================================================== */
|
| 124 |
.navbar {
|
| 125 |
display: flex;
|
| 126 |
align-items: center;
|
| 127 |
justify-content: space-between;
|
| 128 |
padding: 1.25rem 0;
|
| 129 |
+
border-bottom: var(--border-md);
|
| 130 |
margin-bottom: 2rem;
|
| 131 |
+
gap: 1rem;
|
| 132 |
+
width: 100%;
|
| 133 |
+
min-width: 0;
|
| 134 |
}
|
| 135 |
|
| 136 |
.brand {
|
| 137 |
display: flex;
|
| 138 |
align-items: center;
|
| 139 |
gap: 0.85rem;
|
| 140 |
+
text-decoration: none;
|
| 141 |
+
color: inherit;
|
| 142 |
+
min-width: 0;
|
| 143 |
+
flex-shrink: 1;
|
| 144 |
}
|
| 145 |
|
| 146 |
+
.brand-logo {
|
|
|
|
|
|
|
|
|
|
| 147 |
width: 44px;
|
| 148 |
height: 44px;
|
| 149 |
+
border-radius: var(--radius-sm);
|
| 150 |
+
border: var(--border-sm);
|
| 151 |
+
box-shadow: var(--shadow-sm);
|
| 152 |
+
display: block;
|
| 153 |
+
flex-shrink: 0;
|
| 154 |
+
object-fit: contain;
|
| 155 |
+
background: var(--color-primary);
|
| 156 |
+
transition: transform var(--transition-tactile);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.brand:hover .brand-logo {
|
| 160 |
+
transform: rotate(-3deg) scale(1.05);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
.brand-title-wrap {
|
| 164 |
+
display: flex;
|
| 165 |
+
flex-direction: column;
|
| 166 |
+
min-width: 0;
|
| 167 |
}
|
| 168 |
|
| 169 |
.brand-title {
|
| 170 |
+
font-size: 1.35rem;
|
| 171 |
+
font-weight: 800;
|
| 172 |
+
color: var(--text-primary);
|
| 173 |
+
letter-spacing: -0.03em;
|
| 174 |
+
white-space: nowrap;
|
| 175 |
+
display: flex;
|
| 176 |
+
align-items: center;
|
| 177 |
+
gap: 0.5rem;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.brand-tag {
|
| 181 |
+
font-size: 0.65rem;
|
| 182 |
+
font-family: var(--font-mono);
|
| 183 |
+
font-weight: 800;
|
| 184 |
+
background: var(--color-primary);
|
| 185 |
+
color: #000;
|
| 186 |
+
padding: 0.15rem 0.45rem;
|
| 187 |
+
border: var(--border-sm);
|
| 188 |
+
box-shadow: 1px 1px 0px var(--shadow-color);
|
| 189 |
+
border-radius: var(--radius-xs);
|
| 190 |
+
text-transform: uppercase;
|
| 191 |
+
letter-spacing: 0.05em;
|
| 192 |
}
|
| 193 |
|
| 194 |
.brand-sub {
|
| 195 |
+
font-size: 0.78rem;
|
| 196 |
+
font-weight: 600;
|
| 197 |
color: var(--text-muted);
|
| 198 |
+
white-space: nowrap;
|
| 199 |
+
overflow: hidden;
|
| 200 |
+
text-overflow: ellipsis;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/* Nav Links */
|
| 204 |
+
.nav-links {
|
| 205 |
+
display: flex;
|
| 206 |
+
align-items: center;
|
| 207 |
+
gap: 0.75rem;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
.nav-anchor {
|
| 211 |
+
color: var(--text-primary);
|
| 212 |
+
text-decoration: none;
|
| 213 |
+
font-size: 0.88rem;
|
| 214 |
+
font-weight: 700;
|
| 215 |
+
padding: 0.45rem 0.85rem;
|
| 216 |
+
border: var(--border-sm);
|
| 217 |
+
border-radius: var(--radius-sm);
|
| 218 |
+
background: var(--bg-card);
|
| 219 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 220 |
+
transition: all var(--transition-tactile);
|
| 221 |
}
|
| 222 |
|
| 223 |
+
.nav-anchor:hover {
|
| 224 |
+
background: var(--color-primary);
|
| 225 |
+
color: #000000;
|
| 226 |
+
transform: translate(-2px, -2px);
|
| 227 |
+
box-shadow: 4px 4px 0px var(--shadow-color);
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
.nav-anchor:active {
|
| 231 |
+
transform: translate(2px, 2px);
|
| 232 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
/* Nav Actions */
|
| 236 |
.nav-actions {
|
| 237 |
display: flex;
|
| 238 |
align-items: center;
|
| 239 |
+
gap: 0.65rem;
|
| 240 |
+
flex-shrink: 0;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
/* Status Badge */
|
| 244 |
+
.status-badge {
|
| 245 |
+
display: inline-flex;
|
| 246 |
+
align-items: center;
|
| 247 |
+
gap: 0.5rem;
|
| 248 |
+
padding: 0.45rem 0.75rem;
|
| 249 |
+
border-radius: var(--radius-sm);
|
| 250 |
+
font-size: 0.75rem;
|
| 251 |
+
font-family: var(--font-mono);
|
| 252 |
+
font-weight: 800;
|
| 253 |
+
border: var(--border-sm);
|
| 254 |
+
box-shadow: var(--shadow-sm);
|
| 255 |
+
background: var(--bg-card);
|
| 256 |
+
white-space: nowrap;
|
| 257 |
+
flex-shrink: 0;
|
| 258 |
+
min-height: 40px;
|
| 259 |
+
color: var(--text-primary);
|
| 260 |
+
transition: transform var(--transition-tactile);
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.status-dot {
|
| 264 |
+
width: 10px;
|
| 265 |
+
height: 10px;
|
| 266 |
+
border-radius: 50%;
|
| 267 |
+
border: 1.5px solid #000;
|
| 268 |
+
flex-shrink: 0;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
.status-badge.online .status-dot {
|
| 272 |
+
background-color: var(--color-accent-green);
|
| 273 |
+
}
|
| 274 |
+
.status-badge.online {
|
| 275 |
+
background: #E8F5E9;
|
| 276 |
+
color: #000000;
|
| 277 |
+
}
|
| 278 |
+
[data-theme="dark"] .status-badge.online {
|
| 279 |
+
background: #1B3520;
|
| 280 |
+
color: #ffffff;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
.status-badge.checking .status-dot {
|
| 284 |
+
background-color: var(--color-primary);
|
| 285 |
+
}
|
| 286 |
+
.status-badge.checking {
|
| 287 |
+
background: #FFFDE7;
|
| 288 |
+
color: #000000;
|
| 289 |
+
}
|
| 290 |
+
[data-theme="dark"] .status-badge.checking {
|
| 291 |
+
background: #3B381A;
|
| 292 |
+
color: #ffffff;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
.status-badge.offline .status-dot {
|
| 296 |
+
background-color: var(--color-secondary);
|
| 297 |
+
}
|
| 298 |
+
.status-badge.offline {
|
| 299 |
+
background: #FFEBEE;
|
| 300 |
+
color: #000000;
|
| 301 |
+
}
|
| 302 |
+
[data-theme="dark"] .status-badge.offline {
|
| 303 |
+
background: #3B1B1B;
|
| 304 |
+
color: #ffffff;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
/* Theme Toggle Button */
|
| 308 |
+
.theme-toggle-btn {
|
| 309 |
+
display: inline-flex;
|
| 310 |
+
align-items: center;
|
| 311 |
+
justify-content: center;
|
| 312 |
+
width: 42px;
|
| 313 |
+
height: 42px;
|
| 314 |
+
min-width: 42px;
|
| 315 |
+
min-height: 42px;
|
| 316 |
+
border-radius: var(--radius-sm);
|
| 317 |
+
border: var(--border-sm);
|
| 318 |
+
box-shadow: var(--shadow-sm);
|
| 319 |
+
background: var(--color-primary);
|
| 320 |
+
color: #000000;
|
| 321 |
+
cursor: pointer;
|
| 322 |
+
transition: all var(--transition-tactile);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
.theme-toggle-btn:hover {
|
| 326 |
+
transform: translate(-2px, -2px);
|
| 327 |
+
box-shadow: var(--shadow-md);
|
| 328 |
+
background: #FFD600;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
.theme-toggle-btn:active {
|
| 332 |
+
transform: translate(2px, 2px);
|
| 333 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
/* Nav Link Button */
|
| 337 |
+
.nav-link-btn {
|
| 338 |
+
display: inline-flex;
|
| 339 |
+
align-items: center;
|
| 340 |
+
gap: 0.45rem;
|
| 341 |
+
font-size: 0.82rem;
|
| 342 |
+
font-weight: 700;
|
| 343 |
+
color: var(--text-primary);
|
| 344 |
+
text-decoration: none;
|
| 345 |
+
padding: 0.45rem 0.85rem;
|
| 346 |
+
border-radius: var(--radius-sm);
|
| 347 |
+
border: var(--border-sm);
|
| 348 |
+
box-shadow: var(--shadow-sm);
|
| 349 |
+
background: var(--bg-card);
|
| 350 |
+
min-height: 40px;
|
| 351 |
+
transition: all var(--transition-tactile);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
.nav-link-btn:hover {
|
| 355 |
+
background: var(--color-tertiary);
|
| 356 |
+
color: #ffffff;
|
| 357 |
+
transform: translate(-2px, -2px);
|
| 358 |
+
box-shadow: var(--shadow-md);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
.nav-link-btn:active {
|
| 362 |
+
transform: translate(2px, 2px);
|
| 363 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
/* Mobile Menu Button */
|
| 367 |
+
.mobile-menu-btn {
|
| 368 |
+
display: none;
|
| 369 |
+
background: var(--color-primary);
|
| 370 |
+
border: var(--border-sm);
|
| 371 |
+
box-shadow: var(--shadow-sm);
|
| 372 |
+
color: #000000;
|
| 373 |
+
padding: 0.4rem;
|
| 374 |
+
border-radius: var(--radius-sm);
|
| 375 |
+
cursor: pointer;
|
| 376 |
+
min-width: 44px;
|
| 377 |
+
min-height: 44px;
|
| 378 |
+
align-items: center;
|
| 379 |
+
justify-content: center;
|
| 380 |
+
transition: all var(--transition-tactile);
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
.mobile-menu-btn:hover {
|
| 384 |
+
transform: translate(-2px, -2px);
|
| 385 |
+
box-shadow: var(--shadow-md);
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
.mobile-menu-btn:active {
|
| 389 |
+
transform: translate(2px, 2px);
|
| 390 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
/* ==========================================================================
|
| 394 |
+
MOBILE STUDIO SWITCHER (TABS FOR SMALL SCREENS)
|
| 395 |
+
========================================================================== */
|
| 396 |
+
.mobile-studio-switcher {
|
| 397 |
+
display: none;
|
| 398 |
+
grid-template-columns: 1fr 1fr;
|
| 399 |
+
gap: 0.75rem;
|
| 400 |
+
background: var(--bg-nested);
|
| 401 |
+
padding: 0.5rem;
|
| 402 |
+
border-radius: var(--radius-md);
|
| 403 |
+
border: var(--border-md);
|
| 404 |
+
box-shadow: var(--shadow-sm);
|
| 405 |
+
margin-bottom: 1.5rem;
|
| 406 |
+
width: 100%;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
.studio-tab-btn {
|
| 410 |
+
display: inline-flex;
|
| 411 |
+
align-items: center;
|
| 412 |
+
justify-content: center;
|
| 413 |
+
gap: 0.5rem;
|
| 414 |
+
padding: 0.65rem 0.85rem;
|
| 415 |
+
min-height: 46px;
|
| 416 |
+
border: var(--border-sm);
|
| 417 |
+
border-radius: var(--radius-sm);
|
| 418 |
+
background: var(--bg-card);
|
| 419 |
+
color: var(--text-primary);
|
| 420 |
+
font-size: 0.88rem;
|
| 421 |
+
font-weight: 700;
|
| 422 |
+
cursor: pointer;
|
| 423 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 424 |
+
transition: all var(--transition-tactile);
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
.studio-tab-btn:hover {
|
| 428 |
+
background: var(--bg-card-hover);
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
.studio-tab-btn.active {
|
| 432 |
+
background: var(--color-primary);
|
| 433 |
+
color: #000000;
|
| 434 |
+
box-shadow: 3px 3px 0px var(--shadow-color);
|
| 435 |
+
transform: translate(-1px, -1px);
|
| 436 |
}
|
| 437 |
|
| 438 |
+
.studio-tab-btn .tab-badge {
|
| 439 |
+
font-size: 0.65rem;
|
| 440 |
+
font-family: var(--font-mono);
|
| 441 |
+
padding: 0.15rem 0.4rem;
|
| 442 |
+
border-radius: var(--radius-xs);
|
| 443 |
+
background: var(--color-accent-green);
|
| 444 |
+
color: #000000;
|
| 445 |
+
border: 1.5px solid #000;
|
| 446 |
+
font-weight: 800;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/* ==========================================================================
|
| 450 |
+
STUDIO CONTAINER GRID
|
| 451 |
+
========================================================================== */
|
| 452 |
.studio-container {
|
| 453 |
display: grid;
|
| 454 |
+
grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
|
| 455 |
+
gap: 1.75rem;
|
| 456 |
align-items: start;
|
| 457 |
+
width: 100%;
|
| 458 |
+
min-width: 0;
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
/* Focus Ring standard for Keyboard Accessibility */
|
| 462 |
+
:focus-visible {
|
| 463 |
+
outline: 3px solid var(--color-secondary) !important;
|
| 464 |
+
outline-offset: 3px !important;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
/* Custom Neubrutalist Scrollbars */
|
| 468 |
+
::-webkit-scrollbar {
|
| 469 |
+
width: 8px;
|
| 470 |
+
height: 8px;
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
::-webkit-scrollbar-track {
|
| 474 |
+
background: var(--bg-page);
|
| 475 |
+
border-left: var(--border-sm);
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
::-webkit-scrollbar-thumb {
|
| 479 |
+
background: var(--color-primary);
|
| 480 |
+
border: var(--border-sm);
|
| 481 |
+
border-radius: var(--radius-xs);
|
| 482 |
}
|
| 483 |
|
| 484 |
+
::-webkit-scrollbar-thumb:hover {
|
| 485 |
+
background: #FFD600;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
/* Responsive Media Queries */
|
| 489 |
@media (max-width: 960px) {
|
| 490 |
+
.mobile-studio-switcher {
|
| 491 |
+
display: grid;
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
.studio-container {
|
| 495 |
+
grid-template-columns: minmax(0, 1fr);
|
| 496 |
+
gap: 1.25rem;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
.panel:not(.active-mobile-view) {
|
| 500 |
+
display: none;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
.panel.active-mobile-view {
|
| 504 |
+
display: block;
|
| 505 |
+
animation: neubrutalFadeIn 0.2s ease-out;
|
| 506 |
+
}
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
@media (max-width: 768px) {
|
| 510 |
+
.app-layout {
|
| 511 |
+
padding: 0 1rem 2.5rem;
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
.nav-links {
|
| 515 |
+
display: none;
|
| 516 |
+
position: absolute;
|
| 517 |
+
top: calc(100% + 0.5rem);
|
| 518 |
+
left: 0;
|
| 519 |
+
right: 0;
|
| 520 |
+
flex-direction: column;
|
| 521 |
+
background: var(--bg-card);
|
| 522 |
+
border: var(--border-md);
|
| 523 |
+
border-radius: var(--radius-md);
|
| 524 |
+
padding: 0.75rem;
|
| 525 |
+
gap: 0.5rem;
|
| 526 |
+
z-index: 100;
|
| 527 |
+
box-shadow: var(--shadow-lg);
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
.nav-links.open {
|
| 531 |
+
display: flex;
|
| 532 |
+
animation: neubrutalFadeIn 0.2s ease-out;
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
.nav-links .nav-anchor {
|
| 536 |
+
display: flex;
|
| 537 |
+
align-items: center;
|
| 538 |
+
padding: 0.75rem 1rem;
|
| 539 |
+
min-height: 44px;
|
| 540 |
+
width: 100%;
|
| 541 |
+
font-size: 0.95rem;
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
.mobile-menu-btn {
|
| 545 |
+
display: inline-flex;
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
.navbar {
|
| 549 |
+
position: relative;
|
| 550 |
+
padding: 1rem 0;
|
| 551 |
+
margin-bottom: 1.5rem;
|
| 552 |
+
}
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
@media (max-width: 640px) {
|
| 556 |
+
.app-layout {
|
| 557 |
+
padding: 0 0.85rem 2rem;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
.brand-sub {
|
| 561 |
+
display: none;
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
.brand-logo {
|
| 565 |
+
width: 38px;
|
| 566 |
+
height: 38px;
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
.brand-title {
|
| 570 |
+
font-size: 1.15rem;
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
.nav-actions {
|
| 574 |
+
gap: 0.5rem;
|
| 575 |
+
}
|
| 576 |
+
}
|
| 577 |
+
|
| 578 |
+
@media (max-width: 480px) {
|
| 579 |
+
#apiStatusBadge .status-text {
|
| 580 |
+
display: none;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
#apiStatusBadge {
|
| 584 |
+
padding: 0.4rem 0.55rem;
|
| 585 |
+
min-height: 40px;
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
.nav-link-btn span {
|
| 589 |
+
display: none;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
.nav-link-btn {
|
| 593 |
+
padding: 0.4rem 0.6rem;
|
| 594 |
+
min-width: 42px;
|
| 595 |
+
justify-content: center;
|
| 596 |
+
}
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
@keyframes neubrutalFadeIn {
|
| 600 |
+
from {
|
| 601 |
+
opacity: 0;
|
| 602 |
+
transform: translateY(6px);
|
| 603 |
+
}
|
| 604 |
+
to {
|
| 605 |
+
opacity: 1;
|
| 606 |
+
transform: translateY(0);
|
| 607 |
}
|
| 608 |
}
|
frontend/src/styles/components.css
CHANGED
|
@@ -1,272 +1,272 @@
|
|
| 1 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
.panel {
|
| 3 |
background: var(--bg-card);
|
| 4 |
-
|
| 5 |
-
-
|
| 6 |
-
|
| 7 |
-
border-radius: var(--radius-lg);
|
| 8 |
padding: 1.5rem;
|
| 9 |
-
|
|
|
|
| 10 |
}
|
| 11 |
|
| 12 |
.panel-header {
|
| 13 |
display: flex;
|
| 14 |
align-items: center;
|
| 15 |
justify-content: space-between;
|
| 16 |
-
margin-bottom: 1.
|
| 17 |
-
padding-bottom: 0.
|
| 18 |
-
border-bottom:
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
.panel-title {
|
| 22 |
-
font-
|
| 23 |
-
font-
|
| 24 |
-
font-weight: 600;
|
| 25 |
color: var(--text-primary);
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
/* Status Badge */
|
| 29 |
-
.status-badge {
|
| 30 |
-
display: inline-flex;
|
| 31 |
align-items: center;
|
| 32 |
gap: 0.5rem;
|
| 33 |
-
padding: 0.35rem 0.75rem;
|
| 34 |
-
border-radius: 9999px;
|
| 35 |
-
font-size: 0.75rem;
|
| 36 |
-
font-weight: 500;
|
| 37 |
-
border: 1px solid var(--border-subtle);
|
| 38 |
-
background: rgba(15, 23, 42, 0.6);
|
| 39 |
-
transition: var(--transition-fast);
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
.status-dot {
|
| 43 |
-
width: 8px;
|
| 44 |
-
height: 8px;
|
| 45 |
-
border-radius: 50%;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
.status-badge.online .status-dot {
|
| 49 |
-
background-color: var(--success);
|
| 50 |
-
box-shadow: 0 0 8px var(--success);
|
| 51 |
-
}
|
| 52 |
-
.status-badge.online {
|
| 53 |
-
color: #a7f3d0;
|
| 54 |
-
border-color: rgba(16, 185, 129, 0.3);
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
.status-badge.checking .status-dot {
|
| 58 |
-
background-color: var(--warning);
|
| 59 |
-
box-shadow: 0 0 8px var(--warning);
|
| 60 |
-
animation: pulse 1.5s infinite;
|
| 61 |
-
}
|
| 62 |
-
.status-badge.checking {
|
| 63 |
-
color: #fde68a;
|
| 64 |
-
border-color: rgba(245, 158, 11, 0.3);
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
.status-badge.offline .status-dot {
|
| 68 |
-
background-color: var(--danger);
|
| 69 |
-
}
|
| 70 |
-
.status-badge.offline {
|
| 71 |
-
color: #fca5a5;
|
| 72 |
-
border-color: rgba(239, 68, 68, 0.3);
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
@keyframes pulse {
|
| 76 |
-
0%, 100% { opacity: 1; transform: scale(1); }
|
| 77 |
-
50% { opacity: 0.4; transform: scale(0.9); }
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
/* Links & Buttons */
|
| 81 |
-
.nav-link-btn {
|
| 82 |
-
display: inline-flex;
|
| 83 |
-
align-items: center;
|
| 84 |
-
gap: 0.4rem;
|
| 85 |
-
font-size: 0.8rem;
|
| 86 |
-
font-weight: 500;
|
| 87 |
-
color: var(--text-secondary);
|
| 88 |
-
text-decoration: none;
|
| 89 |
-
padding: 0.45rem 0.85rem;
|
| 90 |
-
border-radius: var(--radius-sm);
|
| 91 |
-
border: 1px solid var(--border-subtle);
|
| 92 |
-
background: rgba(255, 255, 255, 0.03);
|
| 93 |
-
transition: var(--transition-fast);
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
.nav-link-btn:hover {
|
| 97 |
-
color: var(--text-primary);
|
| 98 |
-
border-color: var(--border-hover);
|
| 99 |
-
background: rgba(255, 255, 255, 0.08);
|
| 100 |
}
|
| 101 |
|
|
|
|
| 102 |
.btn-text {
|
| 103 |
-
background:
|
| 104 |
-
border:
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
| 107 |
cursor: pointer;
|
| 108 |
-
padding: 0.
|
| 109 |
-
border-radius: var(--radius-
|
| 110 |
-
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
|
| 113 |
.btn-text:hover {
|
| 114 |
-
|
| 115 |
-
|
|
|
|
| 116 |
}
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
.btn-primary {
|
| 119 |
display: inline-flex;
|
| 120 |
align-items: center;
|
| 121 |
justify-content: center;
|
| 122 |
-
gap: 0.
|
| 123 |
width: 100%;
|
| 124 |
-
padding: 0.
|
| 125 |
-
background: var(--
|
| 126 |
-
border:
|
| 127 |
border-radius: var(--radius-md);
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
font-size:
|
| 131 |
-
font-weight:
|
|
|
|
| 132 |
cursor: pointer;
|
| 133 |
-
|
| 134 |
-
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
-
.btn-primary:hover {
|
| 138 |
-
|
| 139 |
-
transform:
|
| 140 |
-
box-shadow:
|
| 141 |
}
|
| 142 |
|
| 143 |
-
.btn-primary:active {
|
| 144 |
-
transform:
|
|
|
|
| 145 |
}
|
| 146 |
|
| 147 |
.btn-primary:disabled {
|
| 148 |
opacity: 0.6;
|
| 149 |
cursor: not-allowed;
|
| 150 |
transform: none;
|
|
|
|
|
|
|
|
|
|
| 151 |
}
|
| 152 |
|
|
|
|
| 153 |
.btn-secondary,
|
| 154 |
.btn-outline {
|
| 155 |
display: inline-flex;
|
| 156 |
align-items: center;
|
| 157 |
justify-content: center;
|
| 158 |
gap: 0.5rem;
|
| 159 |
-
padding: 0.
|
| 160 |
-
border-radius: var(--radius-
|
| 161 |
-
|
| 162 |
-
font-
|
|
|
|
| 163 |
cursor: pointer;
|
| 164 |
text-decoration: none;
|
| 165 |
-
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
.btn-secondary {
|
| 169 |
-
background: var(--
|
| 170 |
-
color: #
|
| 171 |
-
border: 1px solid var(--accent-primary);
|
| 172 |
}
|
| 173 |
|
| 174 |
.btn-secondary:hover {
|
| 175 |
-
background:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
}
|
| 177 |
|
| 178 |
.btn-outline {
|
| 179 |
-
background:
|
| 180 |
color: var(--text-primary);
|
| 181 |
-
border: 1px solid var(--border-subtle);
|
| 182 |
}
|
| 183 |
|
| 184 |
.btn-outline:hover {
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
}
|
| 188 |
|
| 189 |
-
/*
|
|
|
|
|
|
|
| 190 |
.editor-form {
|
| 191 |
display: flex;
|
| 192 |
flex-direction: column;
|
| 193 |
-
gap: 1.
|
| 194 |
}
|
| 195 |
|
| 196 |
.form-section {
|
| 197 |
-
border:
|
| 198 |
border-radius: var(--radius-md);
|
| 199 |
-
padding:
|
| 200 |
-
background:
|
|
|
|
|
|
|
| 201 |
}
|
| 202 |
|
| 203 |
.section-title {
|
| 204 |
-
display:
|
| 205 |
align-items: center;
|
| 206 |
-
gap: 0.
|
| 207 |
-
font-size: 0.
|
| 208 |
-
font-weight:
|
| 209 |
-
color: var(--
|
| 210 |
-
|
| 211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
}
|
| 213 |
|
| 214 |
.form-group {
|
| 215 |
display: flex;
|
| 216 |
flex-direction: column;
|
| 217 |
-
gap: 0.
|
| 218 |
-
margin-top: 0.
|
| 219 |
}
|
| 220 |
|
| 221 |
.form-group label {
|
| 222 |
-
font-size: 0.
|
| 223 |
-
font-weight:
|
| 224 |
color: var(--text-secondary);
|
|
|
|
|
|
|
| 225 |
}
|
| 226 |
|
| 227 |
.required {
|
| 228 |
-
color: var(--
|
|
|
|
| 229 |
}
|
| 230 |
|
| 231 |
.form-row {
|
| 232 |
display: flex;
|
| 233 |
-
gap: 0.
|
| 234 |
}
|
| 235 |
|
| 236 |
.flex-1 { flex: 1; }
|
| 237 |
.flex-2 { flex: 2; }
|
| 238 |
|
|
|
|
| 239 |
.form-input,
|
| 240 |
.form-textarea,
|
| 241 |
.form-select {
|
| 242 |
width: 100%;
|
| 243 |
background: var(--bg-input);
|
| 244 |
-
border:
|
| 245 |
border-radius: var(--radius-sm);
|
|
|
|
| 246 |
color: var(--text-primary);
|
| 247 |
font-family: inherit;
|
| 248 |
-
font-size: 0.
|
| 249 |
-
|
|
|
|
| 250 |
outline: none;
|
| 251 |
-
|
|
|
|
| 252 |
}
|
| 253 |
|
| 254 |
.form-input:focus,
|
| 255 |
.form-textarea:focus,
|
| 256 |
.form-select:focus {
|
| 257 |
-
border-color: var(--border-
|
| 258 |
-
box-shadow:
|
|
|
|
| 259 |
}
|
| 260 |
|
| 261 |
.form-textarea {
|
| 262 |
resize: vertical;
|
| 263 |
-
min-height:
|
|
|
|
| 264 |
}
|
| 265 |
|
| 266 |
/* Avatar Upload & Quick Pick */
|
| 267 |
.avatar-input-wrapper {
|
| 268 |
display: flex;
|
| 269 |
gap: 0.5rem;
|
|
|
|
| 270 |
}
|
| 271 |
|
| 272 |
.file-hidden {
|
|
@@ -276,130 +276,177 @@
|
|
| 276 |
.upload-btn {
|
| 277 |
display: inline-flex;
|
| 278 |
align-items: center;
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
|
|
|
|
|
|
| 282 |
border-radius: var(--radius-sm);
|
| 283 |
-
padding: 0
|
| 284 |
-
|
| 285 |
-
|
|
|
|
|
|
|
|
|
|
| 286 |
cursor: pointer;
|
| 287 |
white-space: nowrap;
|
| 288 |
-
|
|
|
|
| 289 |
}
|
| 290 |
|
| 291 |
.upload-btn:hover {
|
| 292 |
-
background:
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
}
|
| 296 |
|
| 297 |
.avatar-quick-pick {
|
| 298 |
display: flex;
|
| 299 |
align-items: center;
|
| 300 |
-
gap: 0.
|
| 301 |
-
margin-top: 0.
|
|
|
|
| 302 |
}
|
| 303 |
|
| 304 |
.quick-pick-label {
|
| 305 |
-
font-size: 0.
|
|
|
|
| 306 |
color: var(--text-muted);
|
|
|
|
| 307 |
}
|
| 308 |
|
| 309 |
.preset-avatar-btn {
|
| 310 |
-
background:
|
| 311 |
-
border:
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
|
|
|
|
|
|
|
|
|
| 316 |
cursor: pointer;
|
| 317 |
-
transition: var(--transition-
|
|
|
|
|
|
|
|
|
|
| 318 |
}
|
| 319 |
|
| 320 |
.preset-avatar-btn:hover {
|
| 321 |
-
background:
|
| 322 |
-
color:
|
| 323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
}
|
| 325 |
|
| 326 |
-
/*
|
|
|
|
|
|
|
| 327 |
.toggle-group {
|
| 328 |
-
margin-top: 0.
|
| 329 |
}
|
| 330 |
|
| 331 |
.switch-container {
|
| 332 |
display: inline-flex;
|
| 333 |
align-items: center;
|
| 334 |
-
gap: 0.
|
| 335 |
cursor: pointer;
|
| 336 |
user-select: none;
|
|
|
|
| 337 |
}
|
| 338 |
|
| 339 |
.switch-input {
|
| 340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
}
|
| 342 |
|
| 343 |
.switch-slider {
|
| 344 |
position: relative;
|
| 345 |
-
width:
|
| 346 |
-
height:
|
| 347 |
-
background-color:
|
| 348 |
-
border
|
| 349 |
-
|
|
|
|
|
|
|
| 350 |
}
|
| 351 |
|
| 352 |
.switch-slider::before {
|
| 353 |
content: '';
|
| 354 |
position: absolute;
|
| 355 |
-
top:
|
| 356 |
left: 2px;
|
| 357 |
-
width:
|
| 358 |
-
height:
|
| 359 |
background-color: #ffffff;
|
|
|
|
| 360 |
border-radius: 50%;
|
| 361 |
-
transition: var(--transition-
|
| 362 |
}
|
| 363 |
|
| 364 |
.switch-input:checked + .switch-slider {
|
| 365 |
-
background: var(--accent-
|
| 366 |
}
|
| 367 |
|
| 368 |
.switch-input:checked + .switch-slider::before {
|
| 369 |
transform: translateX(18px);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
}
|
| 371 |
|
| 372 |
.switch-label {
|
| 373 |
-
font-size: 0.
|
| 374 |
-
color: var(--text-
|
| 375 |
-
font-weight:
|
| 376 |
}
|
| 377 |
|
| 378 |
.nested-fields {
|
| 379 |
-
margin-top: 0.
|
| 380 |
-
padding:
|
| 381 |
-
background: var(--bg-
|
|
|
|
| 382 |
border-radius: var(--radius-sm);
|
| 383 |
-
|
| 384 |
}
|
| 385 |
|
| 386 |
.nested-fields.hidden {
|
| 387 |
display: none;
|
| 388 |
}
|
| 389 |
|
| 390 |
-
/*
|
|
|
|
|
|
|
| 391 |
.color-picker-row {
|
| 392 |
display: flex;
|
| 393 |
-
gap: 0.
|
| 394 |
}
|
| 395 |
|
| 396 |
.color-swatch {
|
| 397 |
-webkit-appearance: none;
|
| 398 |
-moz-appearance: none;
|
| 399 |
appearance: none;
|
| 400 |
-
width:
|
| 401 |
-
height:
|
| 402 |
-
border:
|
|
|
|
| 403 |
border-radius: var(--radius-sm);
|
| 404 |
cursor: pointer;
|
| 405 |
background: transparent;
|
|
@@ -412,70 +459,520 @@
|
|
| 412 |
|
| 413 |
.color-swatch::-webkit-color-swatch {
|
| 414 |
border: none;
|
| 415 |
-
border-radius: var(--radius-sm);
|
| 416 |
}
|
| 417 |
|
| 418 |
.hex-input {
|
| 419 |
-
max-width:
|
| 420 |
font-family: var(--font-mono);
|
| 421 |
text-transform: uppercase;
|
|
|
|
| 422 |
}
|
| 423 |
|
| 424 |
.palette-group {
|
| 425 |
display: flex;
|
| 426 |
align-items: center;
|
| 427 |
-
gap: 0.
|
| 428 |
-
margin-top: 0.
|
|
|
|
| 429 |
}
|
| 430 |
|
| 431 |
.palette-btn {
|
| 432 |
-
width:
|
| 433 |
-
height:
|
| 434 |
border-radius: 50%;
|
| 435 |
-
border:
|
|
|
|
| 436 |
cursor: pointer;
|
| 437 |
-
transition: var(--transition-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
}
|
| 439 |
|
| 440 |
.palette-btn:hover {
|
| 441 |
-
transform: scale(1.15);
|
| 442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
}
|
| 444 |
|
| 445 |
-
/*
|
|
|
|
|
|
|
| 446 |
.toast {
|
| 447 |
position: fixed;
|
| 448 |
bottom: 2rem;
|
| 449 |
right: 2rem;
|
| 450 |
-
padding:
|
| 451 |
-
border-radius: var(--radius-
|
| 452 |
-
background:
|
| 453 |
-
color:
|
| 454 |
-
font-size: 0.
|
| 455 |
-
|
| 456 |
-
border:
|
|
|
|
| 457 |
z-index: 1000;
|
| 458 |
display: flex;
|
| 459 |
align-items: center;
|
| 460 |
-
gap: 0.
|
| 461 |
-
animation:
|
| 462 |
}
|
| 463 |
|
| 464 |
.toast.success {
|
| 465 |
-
|
| 466 |
-
|
|
|
|
| 467 |
}
|
| 468 |
|
| 469 |
.toast.error {
|
| 470 |
-
|
| 471 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
}
|
| 473 |
|
| 474 |
.toast.hidden {
|
| 475 |
display: none;
|
| 476 |
}
|
| 477 |
|
| 478 |
-
@keyframes
|
| 479 |
-
from {
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
}
|
|
|
|
| 1 |
+
/* ==========================================================================
|
| 2 |
+
NEUBRUTALISM DESIGN SYSTEM - COMPONENTS.CSS
|
| 3 |
+
Tactile, High-Contrast, Chunky, Playful
|
| 4 |
+
========================================================================== */
|
| 5 |
+
|
| 6 |
+
/* Panels */
|
| 7 |
.panel {
|
| 8 |
background: var(--bg-card);
|
| 9 |
+
border: var(--border-md);
|
| 10 |
+
border-radius: var(--radius-md);
|
| 11 |
+
box-shadow: var(--shadow-lg);
|
|
|
|
| 12 |
padding: 1.5rem;
|
| 13 |
+
min-width: 0;
|
| 14 |
+
transition: box-shadow var(--transition-tactile), background-color var(--transition-tactile);
|
| 15 |
}
|
| 16 |
|
| 17 |
.panel-header {
|
| 18 |
display: flex;
|
| 19 |
align-items: center;
|
| 20 |
justify-content: space-between;
|
| 21 |
+
margin-bottom: 1.35rem;
|
| 22 |
+
padding-bottom: 0.85rem;
|
| 23 |
+
border-bottom: var(--border-sm);
|
| 24 |
+
gap: 0.75rem;
|
| 25 |
}
|
| 26 |
|
| 27 |
.panel-title {
|
| 28 |
+
font-size: 1.25rem;
|
| 29 |
+
font-weight: 800;
|
|
|
|
| 30 |
color: var(--text-primary);
|
| 31 |
+
letter-spacing: -0.02em;
|
| 32 |
+
display: flex;
|
|
|
|
|
|
|
|
|
|
| 33 |
align-items: center;
|
| 34 |
gap: 0.5rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
+
/* Reset / Auxiliary Button */
|
| 38 |
.btn-text {
|
| 39 |
+
background: var(--color-primary);
|
| 40 |
+
border: var(--border-sm);
|
| 41 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 42 |
+
color: #000000;
|
| 43 |
+
font-size: 0.78rem;
|
| 44 |
+
font-weight: 800;
|
| 45 |
cursor: pointer;
|
| 46 |
+
padding: 0.35rem 0.75rem;
|
| 47 |
+
border-radius: var(--radius-xs);
|
| 48 |
+
text-transform: uppercase;
|
| 49 |
+
letter-spacing: 0.05em;
|
| 50 |
+
transition: all var(--transition-tactile);
|
| 51 |
}
|
| 52 |
|
| 53 |
.btn-text:hover {
|
| 54 |
+
background: #FFD600;
|
| 55 |
+
transform: translate(-1px, -1px);
|
| 56 |
+
box-shadow: 3px 3px 0px var(--shadow-color);
|
| 57 |
}
|
| 58 |
|
| 59 |
+
.btn-text:active {
|
| 60 |
+
transform: translate(1px, 1px);
|
| 61 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/* Primary Action Button (Generate Quote) */
|
| 65 |
.btn-primary {
|
| 66 |
display: inline-flex;
|
| 67 |
align-items: center;
|
| 68 |
justify-content: center;
|
| 69 |
+
gap: 0.65rem;
|
| 70 |
width: 100%;
|
| 71 |
+
padding: 0.95rem 1.5rem;
|
| 72 |
+
background: var(--color-primary);
|
| 73 |
+
border: var(--border-md);
|
| 74 |
border-radius: var(--radius-md);
|
| 75 |
+
box-shadow: var(--shadow-md);
|
| 76 |
+
color: #000000;
|
| 77 |
+
font-size: 1.05rem;
|
| 78 |
+
font-weight: 800;
|
| 79 |
+
letter-spacing: -0.01em;
|
| 80 |
cursor: pointer;
|
| 81 |
+
min-height: 52px;
|
| 82 |
+
text-transform: uppercase;
|
| 83 |
+
transition: all var(--transition-tactile);
|
| 84 |
}
|
| 85 |
|
| 86 |
+
.btn-primary:hover:not(:disabled) {
|
| 87 |
+
background: #FFD600;
|
| 88 |
+
transform: translate(-2px, -2px);
|
| 89 |
+
box-shadow: var(--shadow-lg);
|
| 90 |
}
|
| 91 |
|
| 92 |
+
.btn-primary:active:not(:disabled) {
|
| 93 |
+
transform: translate(2px, 2px);
|
| 94 |
+
box-shadow: 1px 1px 0px var(--shadow-color);
|
| 95 |
}
|
| 96 |
|
| 97 |
.btn-primary:disabled {
|
| 98 |
opacity: 0.6;
|
| 99 |
cursor: not-allowed;
|
| 100 |
transform: none;
|
| 101 |
+
box-shadow: var(--shadow-sm);
|
| 102 |
+
background: #e0e0e0;
|
| 103 |
+
color: #555555;
|
| 104 |
}
|
| 105 |
|
| 106 |
+
/* Secondary & Action Buttons */
|
| 107 |
.btn-secondary,
|
| 108 |
.btn-outline {
|
| 109 |
display: inline-flex;
|
| 110 |
align-items: center;
|
| 111 |
justify-content: center;
|
| 112 |
gap: 0.5rem;
|
| 113 |
+
padding: 0.7rem 1.35rem;
|
| 114 |
+
border-radius: var(--radius-sm);
|
| 115 |
+
border: var(--border-sm);
|
| 116 |
+
font-size: 0.9rem;
|
| 117 |
+
font-weight: 800;
|
| 118 |
cursor: pointer;
|
| 119 |
text-decoration: none;
|
| 120 |
+
min-height: 44px;
|
| 121 |
+
box-shadow: var(--shadow-sm);
|
| 122 |
+
transition: all var(--transition-tactile);
|
| 123 |
}
|
| 124 |
|
| 125 |
.btn-secondary {
|
| 126 |
+
background: var(--color-primary);
|
| 127 |
+
color: #000000;
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
.btn-secondary:hover {
|
| 131 |
+
background: #FFD600;
|
| 132 |
+
transform: translate(-2px, -2px);
|
| 133 |
+
box-shadow: var(--shadow-md);
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.btn-secondary:active {
|
| 137 |
+
transform: translate(2px, 2px);
|
| 138 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 139 |
}
|
| 140 |
|
| 141 |
.btn-outline {
|
| 142 |
+
background: var(--bg-card);
|
| 143 |
color: var(--text-primary);
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
.btn-outline:hover {
|
| 147 |
+
background: var(--bg-nested);
|
| 148 |
+
transform: translate(-2px, -2px);
|
| 149 |
+
box-shadow: var(--shadow-md);
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.btn-outline:active {
|
| 153 |
+
transform: translate(2px, 2px);
|
| 154 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 155 |
}
|
| 156 |
|
| 157 |
+
/* ==========================================================================
|
| 158 |
+
FORM CONTROLS & SECTIONS
|
| 159 |
+
========================================================================== */
|
| 160 |
.editor-form {
|
| 161 |
display: flex;
|
| 162 |
flex-direction: column;
|
| 163 |
+
gap: 1.35rem;
|
| 164 |
}
|
| 165 |
|
| 166 |
.form-section {
|
| 167 |
+
border: var(--border-sm);
|
| 168 |
border-radius: var(--radius-md);
|
| 169 |
+
padding: 1.25rem;
|
| 170 |
+
background: var(--bg-nested);
|
| 171 |
+
box-shadow: var(--shadow-sm);
|
| 172 |
+
transition: background-color var(--transition-tactile);
|
| 173 |
}
|
| 174 |
|
| 175 |
.section-title {
|
| 176 |
+
display: flex;
|
| 177 |
align-items: center;
|
| 178 |
+
gap: 0.55rem;
|
| 179 |
+
font-size: 0.92rem;
|
| 180 |
+
font-weight: 800;
|
| 181 |
+
color: var(--text-primary);
|
| 182 |
+
margin-bottom: 0.85rem;
|
| 183 |
+
border-bottom: var(--border-sm);
|
| 184 |
+
padding-bottom: 0.55rem;
|
| 185 |
+
text-transform: uppercase;
|
| 186 |
+
letter-spacing: 0.03em;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
.section-title svg {
|
| 190 |
+
color: #000000;
|
| 191 |
+
background: var(--color-primary);
|
| 192 |
+
padding: 3px;
|
| 193 |
+
border: 1.5px solid #000000;
|
| 194 |
+
border-radius: 4px;
|
| 195 |
+
flex-shrink: 0;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
[data-theme="dark"] .section-title svg {
|
| 199 |
+
background: var(--color-primary);
|
| 200 |
+
color: #000000;
|
| 201 |
+
border-color: #000000;
|
| 202 |
}
|
| 203 |
|
| 204 |
.form-group {
|
| 205 |
display: flex;
|
| 206 |
flex-direction: column;
|
| 207 |
+
gap: 0.45rem;
|
| 208 |
+
margin-top: 0.75rem;
|
| 209 |
}
|
| 210 |
|
| 211 |
.form-group label {
|
| 212 |
+
font-size: 0.82rem;
|
| 213 |
+
font-weight: 800;
|
| 214 |
color: var(--text-secondary);
|
| 215 |
+
text-transform: uppercase;
|
| 216 |
+
letter-spacing: 0.04em;
|
| 217 |
}
|
| 218 |
|
| 219 |
.required {
|
| 220 |
+
color: var(--color-secondary);
|
| 221 |
+
font-weight: 900;
|
| 222 |
}
|
| 223 |
|
| 224 |
.form-row {
|
| 225 |
display: flex;
|
| 226 |
+
gap: 0.85rem;
|
| 227 |
}
|
| 228 |
|
| 229 |
.flex-1 { flex: 1; }
|
| 230 |
.flex-2 { flex: 2; }
|
| 231 |
|
| 232 |
+
/* Neubrutalist Inputs, Textareas, Selects */
|
| 233 |
.form-input,
|
| 234 |
.form-textarea,
|
| 235 |
.form-select {
|
| 236 |
width: 100%;
|
| 237 |
background: var(--bg-input);
|
| 238 |
+
border: var(--border-sm);
|
| 239 |
border-radius: var(--radius-sm);
|
| 240 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 241 |
color: var(--text-primary);
|
| 242 |
font-family: inherit;
|
| 243 |
+
font-size: 0.92rem;
|
| 244 |
+
font-weight: 600;
|
| 245 |
+
padding: 0.65rem 0.85rem;
|
| 246 |
outline: none;
|
| 247 |
+
min-height: 44px;
|
| 248 |
+
transition: all var(--transition-tactile);
|
| 249 |
}
|
| 250 |
|
| 251 |
.form-input:focus,
|
| 252 |
.form-textarea:focus,
|
| 253 |
.form-select:focus {
|
| 254 |
+
border-color: var(--border-color);
|
| 255 |
+
box-shadow: 4px 4px 0px var(--shadow-color);
|
| 256 |
+
background: var(--bg-card);
|
| 257 |
}
|
| 258 |
|
| 259 |
.form-textarea {
|
| 260 |
resize: vertical;
|
| 261 |
+
min-height: 90px;
|
| 262 |
+
line-height: 1.5;
|
| 263 |
}
|
| 264 |
|
| 265 |
/* Avatar Upload & Quick Pick */
|
| 266 |
.avatar-input-wrapper {
|
| 267 |
display: flex;
|
| 268 |
gap: 0.5rem;
|
| 269 |
+
min-width: 0;
|
| 270 |
}
|
| 271 |
|
| 272 |
.file-hidden {
|
|
|
|
| 276 |
.upload-btn {
|
| 277 |
display: inline-flex;
|
| 278 |
align-items: center;
|
| 279 |
+
justify-content: center;
|
| 280 |
+
gap: 0.4rem;
|
| 281 |
+
background: var(--color-primary);
|
| 282 |
+
border: var(--border-sm);
|
| 283 |
+
box-shadow: var(--shadow-sm);
|
| 284 |
border-radius: var(--radius-sm);
|
| 285 |
+
padding: 0 1rem;
|
| 286 |
+
min-height: 44px;
|
| 287 |
+
min-width: 44px;
|
| 288 |
+
font-size: 0.85rem;
|
| 289 |
+
font-weight: 800;
|
| 290 |
+
color: #000000;
|
| 291 |
cursor: pointer;
|
| 292 |
white-space: nowrap;
|
| 293 |
+
flex-shrink: 0;
|
| 294 |
+
transition: all var(--transition-tactile);
|
| 295 |
}
|
| 296 |
|
| 297 |
.upload-btn:hover {
|
| 298 |
+
background: #FFD600;
|
| 299 |
+
transform: translate(-2px, -2px);
|
| 300 |
+
box-shadow: var(--shadow-md);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
.upload-btn:active {
|
| 304 |
+
transform: translate(2px, 2px);
|
| 305 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 306 |
}
|
| 307 |
|
| 308 |
.avatar-quick-pick {
|
| 309 |
display: flex;
|
| 310 |
align-items: center;
|
| 311 |
+
gap: 0.5rem;
|
| 312 |
+
margin-top: 0.65rem;
|
| 313 |
+
flex-wrap: wrap;
|
| 314 |
}
|
| 315 |
|
| 316 |
.quick-pick-label {
|
| 317 |
+
font-size: 0.78rem;
|
| 318 |
+
font-weight: 800;
|
| 319 |
color: var(--text-muted);
|
| 320 |
+
text-transform: uppercase;
|
| 321 |
}
|
| 322 |
|
| 323 |
.preset-avatar-btn {
|
| 324 |
+
background: var(--bg-card);
|
| 325 |
+
border: var(--border-sm);
|
| 326 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 327 |
+
color: var(--text-primary);
|
| 328 |
+
font-size: 0.78rem;
|
| 329 |
+
font-weight: 800;
|
| 330 |
+
padding: 0.35rem 0.75rem;
|
| 331 |
+
min-height: 38px;
|
| 332 |
+
border-radius: var(--radius-xs);
|
| 333 |
cursor: pointer;
|
| 334 |
+
transition: all var(--transition-tactile);
|
| 335 |
+
display: inline-flex;
|
| 336 |
+
align-items: center;
|
| 337 |
+
justify-content: center;
|
| 338 |
}
|
| 339 |
|
| 340 |
.preset-avatar-btn:hover {
|
| 341 |
+
background: var(--color-primary);
|
| 342 |
+
color: #000000;
|
| 343 |
+
transform: translate(-1px, -1px);
|
| 344 |
+
box-shadow: 3px 3px 0px var(--shadow-color);
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
.preset-avatar-btn:active {
|
| 348 |
+
transform: translate(1px, 1px);
|
| 349 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 350 |
}
|
| 351 |
|
| 352 |
+
/* ==========================================================================
|
| 353 |
+
TOGGLE SWITCH (NEUBRUTALISM CHECKBOX)
|
| 354 |
+
========================================================================== */
|
| 355 |
.toggle-group {
|
| 356 |
+
margin-top: 0.85rem;
|
| 357 |
}
|
| 358 |
|
| 359 |
.switch-container {
|
| 360 |
display: inline-flex;
|
| 361 |
align-items: center;
|
| 362 |
+
gap: 0.75rem;
|
| 363 |
cursor: pointer;
|
| 364 |
user-select: none;
|
| 365 |
+
min-height: 44px;
|
| 366 |
}
|
| 367 |
|
| 368 |
.switch-input {
|
| 369 |
+
position: absolute;
|
| 370 |
+
width: 1px;
|
| 371 |
+
height: 1px;
|
| 372 |
+
overflow: hidden;
|
| 373 |
+
clip: rect(0 0 0 0);
|
| 374 |
+
white-space: nowrap;
|
| 375 |
}
|
| 376 |
|
| 377 |
.switch-slider {
|
| 378 |
position: relative;
|
| 379 |
+
width: 44px;
|
| 380 |
+
height: 24px;
|
| 381 |
+
background-color: #d1d5db;
|
| 382 |
+
border: 2px solid #000000;
|
| 383 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 384 |
+
border-radius: 12px;
|
| 385 |
+
transition: all var(--transition-tactile);
|
| 386 |
}
|
| 387 |
|
| 388 |
.switch-slider::before {
|
| 389 |
content: '';
|
| 390 |
position: absolute;
|
| 391 |
+
top: 1px;
|
| 392 |
left: 2px;
|
| 393 |
+
width: 18px;
|
| 394 |
+
height: 18px;
|
| 395 |
background-color: #ffffff;
|
| 396 |
+
border: 1.5px solid #000000;
|
| 397 |
border-radius: 50%;
|
| 398 |
+
transition: all var(--transition-tactile);
|
| 399 |
}
|
| 400 |
|
| 401 |
.switch-input:checked + .switch-slider {
|
| 402 |
+
background: var(--color-accent-green);
|
| 403 |
}
|
| 404 |
|
| 405 |
.switch-input:checked + .switch-slider::before {
|
| 406 |
transform: translateX(18px);
|
| 407 |
+
background: #ffffff;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
.switch-input:focus-visible + .switch-slider {
|
| 411 |
+
outline: 3px solid var(--color-secondary);
|
| 412 |
+
outline-offset: 3px;
|
| 413 |
}
|
| 414 |
|
| 415 |
.switch-label {
|
| 416 |
+
font-size: 0.85rem;
|
| 417 |
+
color: var(--text-primary);
|
| 418 |
+
font-weight: 700;
|
| 419 |
}
|
| 420 |
|
| 421 |
.nested-fields {
|
| 422 |
+
margin-top: 0.85rem;
|
| 423 |
+
padding: 1rem;
|
| 424 |
+
background: var(--bg-card);
|
| 425 |
+
border: var(--border-sm);
|
| 426 |
border-radius: var(--radius-sm);
|
| 427 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 428 |
}
|
| 429 |
|
| 430 |
.nested-fields.hidden {
|
| 431 |
display: none;
|
| 432 |
}
|
| 433 |
|
| 434 |
+
/* ==========================================================================
|
| 435 |
+
COLOR PICKER & PRESET PALETTES
|
| 436 |
+
========================================================================== */
|
| 437 |
.color-picker-row {
|
| 438 |
display: flex;
|
| 439 |
+
gap: 0.65rem;
|
| 440 |
}
|
| 441 |
|
| 442 |
.color-swatch {
|
| 443 |
-webkit-appearance: none;
|
| 444 |
-moz-appearance: none;
|
| 445 |
appearance: none;
|
| 446 |
+
width: 44px;
|
| 447 |
+
height: 44px;
|
| 448 |
+
border: var(--border-sm);
|
| 449 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 450 |
border-radius: var(--radius-sm);
|
| 451 |
cursor: pointer;
|
| 452 |
background: transparent;
|
|
|
|
| 459 |
|
| 460 |
.color-swatch::-webkit-color-swatch {
|
| 461 |
border: none;
|
| 462 |
+
border-radius: calc(var(--radius-sm) - 2px);
|
| 463 |
}
|
| 464 |
|
| 465 |
.hex-input {
|
| 466 |
+
max-width: 130px;
|
| 467 |
font-family: var(--font-mono);
|
| 468 |
text-transform: uppercase;
|
| 469 |
+
font-weight: 700;
|
| 470 |
}
|
| 471 |
|
| 472 |
.palette-group {
|
| 473 |
display: flex;
|
| 474 |
align-items: center;
|
| 475 |
+
gap: 0.75rem;
|
| 476 |
+
margin-top: 0.85rem;
|
| 477 |
+
flex-wrap: wrap;
|
| 478 |
}
|
| 479 |
|
| 480 |
.palette-btn {
|
| 481 |
+
width: 36px;
|
| 482 |
+
height: 36px;
|
| 483 |
border-radius: 50%;
|
| 484 |
+
border: 2.5px solid #000000;
|
| 485 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 486 |
cursor: pointer;
|
| 487 |
+
transition: all var(--transition-tactile);
|
| 488 |
+
outline: none;
|
| 489 |
+
position: relative;
|
| 490 |
+
flex-shrink: 0;
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
.palette-btn::before {
|
| 494 |
+
content: '';
|
| 495 |
+
position: absolute;
|
| 496 |
+
top: -6px;
|
| 497 |
+
left: -6px;
|
| 498 |
+
right: -6px;
|
| 499 |
+
bottom: -6px;
|
| 500 |
}
|
| 501 |
|
| 502 |
.palette-btn:hover {
|
| 503 |
+
transform: scale(1.15) translate(-1px, -1px);
|
| 504 |
+
box-shadow: 3px 3px 0px var(--shadow-color);
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
.palette-btn:focus-visible {
|
| 508 |
+
outline: 3px solid var(--color-secondary);
|
| 509 |
+
outline-offset: 3px;
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
.palette-btn.active {
|
| 513 |
+
transform: scale(1.1);
|
| 514 |
+
box-shadow: 0 0 0 3px var(--color-primary), 3px 3px 0px var(--shadow-color);
|
| 515 |
}
|
| 516 |
|
| 517 |
+
/* ==========================================================================
|
| 518 |
+
TOAST NOTIFICATIONS (NEUBRUTAL ALERT)
|
| 519 |
+
========================================================================== */
|
| 520 |
.toast {
|
| 521 |
position: fixed;
|
| 522 |
bottom: 2rem;
|
| 523 |
right: 2rem;
|
| 524 |
+
padding: 1rem 1.6rem;
|
| 525 |
+
border-radius: var(--radius-sm);
|
| 526 |
+
background: var(--bg-card);
|
| 527 |
+
color: var(--text-primary);
|
| 528 |
+
font-size: 0.92rem;
|
| 529 |
+
font-weight: 800;
|
| 530 |
+
border: var(--border-md);
|
| 531 |
+
box-shadow: var(--shadow-xl);
|
| 532 |
z-index: 1000;
|
| 533 |
display: flex;
|
| 534 |
align-items: center;
|
| 535 |
+
gap: 0.75rem;
|
| 536 |
+
animation: neubrutalToastSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
| 537 |
}
|
| 538 |
|
| 539 |
.toast.success {
|
| 540 |
+
background: #E8F5E9;
|
| 541 |
+
color: #000000;
|
| 542 |
+
border-color: #000000;
|
| 543 |
}
|
| 544 |
|
| 545 |
.toast.error {
|
| 546 |
+
background: #FFEBEE;
|
| 547 |
+
color: #000000;
|
| 548 |
+
border-color: #000000;
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
.toast.info {
|
| 552 |
+
background: #E3F2FD;
|
| 553 |
+
color: #000000;
|
| 554 |
+
border-color: #000000;
|
| 555 |
}
|
| 556 |
|
| 557 |
.toast.hidden {
|
| 558 |
display: none;
|
| 559 |
}
|
| 560 |
|
| 561 |
+
@keyframes neubrutalToastSlide {
|
| 562 |
+
from {
|
| 563 |
+
opacity: 0;
|
| 564 |
+
transform: translateY(16px) scale(0.95);
|
| 565 |
+
}
|
| 566 |
+
to {
|
| 567 |
+
opacity: 1;
|
| 568 |
+
transform: translateY(0) scale(1);
|
| 569 |
+
}
|
| 570 |
+
}
|
| 571 |
+
|
| 572 |
+
/* ==========================================================================
|
| 573 |
+
CONTENT SECTIONS & TABLES
|
| 574 |
+
========================================================================== */
|
| 575 |
+
.content-section {
|
| 576 |
+
margin-top: 3.5rem;
|
| 577 |
+
padding-top: 2.5rem;
|
| 578 |
+
border-top: var(--border-md);
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
.section-header {
|
| 582 |
+
margin-bottom: 1.75rem;
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
.section-heading {
|
| 586 |
+
font-size: 1.75rem;
|
| 587 |
+
font-weight: 900;
|
| 588 |
+
color: var(--text-primary);
|
| 589 |
+
margin-bottom: 0.5rem;
|
| 590 |
+
letter-spacing: -0.03em;
|
| 591 |
+
display: inline-block;
|
| 592 |
+
background: var(--color-primary);
|
| 593 |
+
color: #000000;
|
| 594 |
+
padding: 0.2rem 0.75rem;
|
| 595 |
+
border: var(--border-sm);
|
| 596 |
+
box-shadow: var(--shadow-sm);
|
| 597 |
+
border-radius: var(--radius-xs);
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
.section-desc {
|
| 601 |
+
font-size: 0.95rem;
|
| 602 |
+
font-weight: 500;
|
| 603 |
+
color: var(--text-secondary);
|
| 604 |
+
max-width: 680px;
|
| 605 |
+
line-height: 1.6;
|
| 606 |
+
margin-top: 0.5rem;
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
/* Neubrutalist Responsive Table */
|
| 610 |
+
.table-responsive {
|
| 611 |
+
width: 100%;
|
| 612 |
+
overflow-x: auto;
|
| 613 |
+
border: var(--border-md);
|
| 614 |
+
border-radius: var(--radius-md);
|
| 615 |
+
box-shadow: var(--shadow-lg);
|
| 616 |
+
background: var(--bg-card);
|
| 617 |
+
margin-top: 1rem;
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
.api-table {
|
| 621 |
+
width: 100%;
|
| 622 |
+
border-collapse: collapse;
|
| 623 |
+
text-align: left;
|
| 624 |
+
font-size: 0.9rem;
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
.api-table th {
|
| 628 |
+
background: #000000;
|
| 629 |
+
color: var(--color-primary);
|
| 630 |
+
padding: 0.95rem 1.25rem;
|
| 631 |
+
font-weight: 800;
|
| 632 |
+
text-transform: uppercase;
|
| 633 |
+
letter-spacing: 0.05em;
|
| 634 |
+
font-size: 0.82rem;
|
| 635 |
+
border-bottom: var(--border-sm);
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
[data-theme="dark"] .api-table th {
|
| 639 |
+
background: #222222;
|
| 640 |
+
color: var(--color-primary);
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
.api-table td {
|
| 644 |
+
padding: 0.95rem 1.25rem;
|
| 645 |
+
border-bottom: var(--border-sm);
|
| 646 |
+
color: var(--text-primary);
|
| 647 |
+
font-weight: 500;
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
.api-table tr:last-child td {
|
| 651 |
+
border-bottom: none;
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
.api-table tr:hover td {
|
| 655 |
+
background: var(--bg-nested);
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
.method-tag {
|
| 659 |
+
display: inline-block;
|
| 660 |
+
padding: 0.25rem 0.6rem;
|
| 661 |
+
border-radius: var(--radius-xs);
|
| 662 |
+
font-family: var(--font-mono);
|
| 663 |
+
font-size: 0.75rem;
|
| 664 |
+
font-weight: 800;
|
| 665 |
+
border: 1.5px solid #000000;
|
| 666 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 667 |
+
letter-spacing: 0.05em;
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
.method-tag.post {
|
| 671 |
+
background: var(--color-secondary);
|
| 672 |
+
color: #ffffff;
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
.method-tag.get {
|
| 676 |
+
background: var(--color-tertiary);
|
| 677 |
+
color: #ffffff;
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
.endpoint-path {
|
| 681 |
+
font-family: var(--font-mono);
|
| 682 |
+
color: var(--text-primary);
|
| 683 |
+
font-weight: 700;
|
| 684 |
+
background: var(--bg-nested);
|
| 685 |
+
padding: 0.15rem 0.4rem;
|
| 686 |
+
border: 1px solid var(--border-color);
|
| 687 |
+
border-radius: 4px;
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
/* ==========================================================================
|
| 691 |
+
OUTPUT FORMAT MODES GRID (ASMMETRIC / ZIG-ZAG CARDS)
|
| 692 |
+
========================================================================== */
|
| 693 |
+
.modes-grid {
|
| 694 |
+
display: grid;
|
| 695 |
+
grid-template-columns: repeat(3, 1fr);
|
| 696 |
+
gap: 1.5rem;
|
| 697 |
+
margin-top: 1rem;
|
| 698 |
+
}
|
| 699 |
+
|
| 700 |
+
@media (max-width: 900px) {
|
| 701 |
+
.modes-grid {
|
| 702 |
+
grid-template-columns: 1fr;
|
| 703 |
+
}
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
.mode-card {
|
| 707 |
+
background: var(--bg-card);
|
| 708 |
+
border: var(--border-md);
|
| 709 |
+
border-radius: var(--radius-md);
|
| 710 |
+
box-shadow: var(--shadow-md);
|
| 711 |
+
padding: 1.5rem;
|
| 712 |
+
position: relative;
|
| 713 |
+
overflow: hidden;
|
| 714 |
+
transition: all var(--transition-tactile);
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
.mode-card::before {
|
| 718 |
+
content: '';
|
| 719 |
+
position: absolute;
|
| 720 |
+
top: 0;
|
| 721 |
+
left: 0;
|
| 722 |
+
right: 0;
|
| 723 |
+
height: 8px;
|
| 724 |
+
background: var(--color-primary);
|
| 725 |
+
border-bottom: var(--border-sm);
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
.mode-card:nth-child(2)::before {
|
| 729 |
+
background: var(--color-secondary);
|
| 730 |
+
}
|
| 731 |
+
|
| 732 |
+
.mode-card:nth-child(3)::before {
|
| 733 |
+
background: var(--color-tertiary);
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
+
.mode-card:hover {
|
| 737 |
+
transform: translate(-3px, -3px);
|
| 738 |
+
box-shadow: var(--shadow-lg);
|
| 739 |
+
}
|
| 740 |
+
|
| 741 |
+
.mode-card-title {
|
| 742 |
+
font-size: 1.2rem;
|
| 743 |
+
font-weight: 800;
|
| 744 |
+
color: var(--text-primary);
|
| 745 |
+
margin-top: 0.4rem;
|
| 746 |
+
margin-bottom: 0.65rem;
|
| 747 |
+
letter-spacing: -0.02em;
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
.mode-card-desc {
|
| 751 |
+
font-size: 0.88rem;
|
| 752 |
+
color: var(--text-secondary);
|
| 753 |
+
line-height: 1.6;
|
| 754 |
+
margin-bottom: 1rem;
|
| 755 |
+
}
|
| 756 |
+
|
| 757 |
+
.mode-specs-list {
|
| 758 |
+
list-style: none;
|
| 759 |
+
font-size: 0.82rem;
|
| 760 |
+
font-weight: 700;
|
| 761 |
+
color: var(--text-primary);
|
| 762 |
+
display: flex;
|
| 763 |
+
flex-direction: column;
|
| 764 |
+
gap: 0.45rem;
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
.mode-specs-list li {
|
| 768 |
+
display: flex;
|
| 769 |
+
align-items: center;
|
| 770 |
+
gap: 0.5rem;
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
.mode-specs-list li svg {
|
| 774 |
+
color: #000000;
|
| 775 |
+
background: var(--color-primary);
|
| 776 |
+
padding: 2px;
|
| 777 |
+
border: 1px solid #000000;
|
| 778 |
+
border-radius: 3px;
|
| 779 |
+
flex-shrink: 0;
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
/* ==========================================================================
|
| 783 |
+
FAQ ACCORDION (NEUBRUTAL DETAILS)
|
| 784 |
+
========================================================================== */
|
| 785 |
+
.faq-grid {
|
| 786 |
+
display: flex;
|
| 787 |
+
flex-direction: column;
|
| 788 |
+
gap: 1rem;
|
| 789 |
+
margin-top: 1rem;
|
| 790 |
+
}
|
| 791 |
+
|
| 792 |
+
.faq-item {
|
| 793 |
+
background: var(--bg-card);
|
| 794 |
+
border: var(--border-md);
|
| 795 |
+
border-radius: var(--radius-md);
|
| 796 |
+
box-shadow: var(--shadow-sm);
|
| 797 |
+
overflow: hidden;
|
| 798 |
+
transition: all var(--transition-tactile);
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
.faq-item:hover {
|
| 802 |
+
transform: translate(-2px, -2px);
|
| 803 |
+
box-shadow: var(--shadow-md);
|
| 804 |
+
}
|
| 805 |
+
|
| 806 |
+
.faq-item[open] {
|
| 807 |
+
background: var(--bg-nested);
|
| 808 |
+
box-shadow: var(--shadow-md);
|
| 809 |
+
}
|
| 810 |
+
|
| 811 |
+
.faq-summary {
|
| 812 |
+
padding: 1.15rem 1.35rem;
|
| 813 |
+
font-weight: 800;
|
| 814 |
+
font-size: 0.98rem;
|
| 815 |
+
color: var(--text-primary);
|
| 816 |
+
cursor: pointer;
|
| 817 |
+
list-style: none;
|
| 818 |
+
display: flex;
|
| 819 |
+
align-items: center;
|
| 820 |
+
justify-content: space-between;
|
| 821 |
+
user-select: none;
|
| 822 |
+
gap: 1rem;
|
| 823 |
+
letter-spacing: -0.01em;
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
.faq-summary::-webkit-details-marker {
|
| 827 |
+
display: none;
|
| 828 |
+
}
|
| 829 |
+
|
| 830 |
+
.faq-summary::after {
|
| 831 |
+
content: '+';
|
| 832 |
+
display: inline-flex;
|
| 833 |
+
align-items: center;
|
| 834 |
+
justify-content: center;
|
| 835 |
+
width: 28px;
|
| 836 |
+
height: 28px;
|
| 837 |
+
background: var(--color-primary);
|
| 838 |
+
color: #000000;
|
| 839 |
+
border: var(--border-sm);
|
| 840 |
+
border-radius: var(--radius-xs);
|
| 841 |
+
box-shadow: 1.5px 1.5px 0px var(--shadow-color);
|
| 842 |
+
font-size: 1.2rem;
|
| 843 |
+
font-weight: 900;
|
| 844 |
+
flex-shrink: 0;
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
.faq-item[open] .faq-summary::after {
|
| 848 |
+
content: '\2212';
|
| 849 |
+
background: var(--color-secondary);
|
| 850 |
+
color: #ffffff;
|
| 851 |
+
}
|
| 852 |
+
|
| 853 |
+
.faq-answer {
|
| 854 |
+
padding: 0 1.35rem 1.25rem;
|
| 855 |
+
font-size: 0.92rem;
|
| 856 |
+
color: var(--text-secondary);
|
| 857 |
+
line-height: 1.65;
|
| 858 |
+
border-top: var(--border-sm);
|
| 859 |
+
padding-top: 1rem;
|
| 860 |
+
margin-top: 0.25rem;
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
/* ==========================================================================
|
| 864 |
+
FOOTER (NEUBRUTALISM SITE FOOTER)
|
| 865 |
+
========================================================================== */
|
| 866 |
+
.site-footer {
|
| 867 |
+
margin-top: 4.5rem;
|
| 868 |
+
padding: 2.5rem 0 1.5rem;
|
| 869 |
+
border-top: var(--border-lg);
|
| 870 |
+
display: flex;
|
| 871 |
+
flex-direction: column;
|
| 872 |
+
gap: 1.5rem;
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
.footer-top {
|
| 876 |
+
display: flex;
|
| 877 |
+
align-items: center;
|
| 878 |
+
justify-content: space-between;
|
| 879 |
+
flex-wrap: wrap;
|
| 880 |
+
gap: 1.5rem;
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
.footer-brand-text {
|
| 884 |
+
font-weight: 900;
|
| 885 |
+
color: var(--text-primary);
|
| 886 |
+
font-size: 1.25rem;
|
| 887 |
+
letter-spacing: -0.02em;
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
.footer-sub {
|
| 891 |
+
font-size: 0.85rem;
|
| 892 |
+
font-weight: 600;
|
| 893 |
+
color: var(--text-muted);
|
| 894 |
+
}
|
| 895 |
+
|
| 896 |
+
.footer-links {
|
| 897 |
+
display: flex;
|
| 898 |
+
align-items: center;
|
| 899 |
+
gap: 0.85rem;
|
| 900 |
+
flex-wrap: wrap;
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
.footer-link {
|
| 904 |
+
color: var(--text-primary);
|
| 905 |
+
text-decoration: none;
|
| 906 |
+
font-size: 0.88rem;
|
| 907 |
+
font-weight: 700;
|
| 908 |
+
padding: 0.35rem 0.65rem;
|
| 909 |
+
border: var(--border-sm);
|
| 910 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 911 |
+
background: var(--bg-card);
|
| 912 |
+
border-radius: var(--radius-xs);
|
| 913 |
+
transition: all var(--transition-tactile);
|
| 914 |
+
}
|
| 915 |
+
|
| 916 |
+
.footer-link:hover {
|
| 917 |
+
background: var(--color-primary);
|
| 918 |
+
color: #000000;
|
| 919 |
+
transform: translate(-2px, -2px);
|
| 920 |
+
box-shadow: 3px 3px 0px var(--shadow-color);
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
.footer-link:active {
|
| 924 |
+
transform: translate(1px, 1px);
|
| 925 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 926 |
+
}
|
| 927 |
+
|
| 928 |
+
.footer-bottom {
|
| 929 |
+
display: flex;
|
| 930 |
+
align-items: center;
|
| 931 |
+
justify-content: space-between;
|
| 932 |
+
font-size: 0.82rem;
|
| 933 |
+
font-weight: 600;
|
| 934 |
+
color: var(--text-muted);
|
| 935 |
+
flex-wrap: wrap;
|
| 936 |
+
gap: 0.75rem;
|
| 937 |
+
padding-top: 1.25rem;
|
| 938 |
+
border-top: var(--border-sm);
|
| 939 |
+
}
|
| 940 |
+
|
| 941 |
+
/* Spinner */
|
| 942 |
+
@keyframes spin {
|
| 943 |
+
to { transform: rotate(360deg); }
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
.spin {
|
| 947 |
+
animation: spin 0.8s linear infinite;
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
/* Mobile Adjustments */
|
| 951 |
+
@media (max-width: 640px) {
|
| 952 |
+
.panel {
|
| 953 |
+
padding: 1.15rem;
|
| 954 |
+
}
|
| 955 |
+
.form-row {
|
| 956 |
+
flex-direction: column;
|
| 957 |
+
gap: 0.75rem;
|
| 958 |
+
}
|
| 959 |
+
.form-input,
|
| 960 |
+
.form-textarea,
|
| 961 |
+
.form-select {
|
| 962 |
+
font-size: 16px; /* Prevents auto-zoom on iOS */
|
| 963 |
+
}
|
| 964 |
+
.toast {
|
| 965 |
+
bottom: 1.25rem;
|
| 966 |
+
right: 1rem;
|
| 967 |
+
left: 1rem;
|
| 968 |
+
justify-content: center;
|
| 969 |
+
text-align: center;
|
| 970 |
+
}
|
| 971 |
+
.footer-top {
|
| 972 |
+
flex-direction: column;
|
| 973 |
+
align-items: flex-start;
|
| 974 |
+
}
|
| 975 |
+
.footer-links {
|
| 976 |
+
gap: 0.65rem;
|
| 977 |
+
}
|
| 978 |
}
|
frontend/src/styles/preview.css
CHANGED
|
@@ -1,43 +1,86 @@
|
|
| 1 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
.preview-panel {
|
| 3 |
position: sticky;
|
| 4 |
top: 1.5rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
}
|
| 6 |
|
|
|
|
| 7 |
.preview-mode-tag {
|
| 8 |
-
font-size: 0.
|
| 9 |
-
font-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
text-transform: uppercase;
|
| 16 |
-
letter-spacing: 0.
|
| 17 |
}
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
.preview-stage-container {
|
| 20 |
display: flex;
|
| 21 |
align-items: center;
|
| 22 |
justify-content: center;
|
| 23 |
-
min-height:
|
| 24 |
-
padding:
|
| 25 |
-
background: #
|
| 26 |
border-radius: var(--radius-md);
|
| 27 |
-
border:
|
|
|
|
| 28 |
position: relative;
|
| 29 |
overflow: hidden;
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
-
/* Telegram Simulated Card */
|
| 34 |
.telegram-quote-card {
|
| 35 |
display: flex;
|
| 36 |
align-items: flex-start;
|
| 37 |
-
gap: 0.
|
| 38 |
-
max-width:
|
| 39 |
width: 100%;
|
| 40 |
-
|
| 41 |
}
|
| 42 |
|
| 43 |
.tg-avatar-col {
|
|
@@ -49,41 +92,49 @@
|
|
| 49 |
height: 44px;
|
| 50 |
border-radius: 50%;
|
| 51 |
object-fit: cover;
|
| 52 |
-
|
| 53 |
-
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
.tg-bubble-col {
|
| 57 |
flex: 1;
|
| 58 |
background: #1b1e23;
|
| 59 |
border-radius: 14px 14px 14px 4px;
|
| 60 |
-
padding: 0.
|
| 61 |
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
| 62 |
position: relative;
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
|
| 66 |
.tg-bubble-header {
|
| 67 |
display: flex;
|
| 68 |
align-items: center;
|
| 69 |
gap: 0.5rem;
|
| 70 |
-
margin-bottom: 0.
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
.tg-sender-name {
|
| 74 |
-
font-size: 0.
|
| 75 |
-
font-weight:
|
| 76 |
color: #e07a5f;
|
| 77 |
letter-spacing: -0.01em;
|
|
|
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
.tg-sender-badge {
|
| 81 |
font-size: 0.65rem;
|
| 82 |
-
font-weight:
|
| 83 |
-
padding: 0.
|
| 84 |
border-radius: 4px;
|
| 85 |
-
background: rgba(255, 255, 255, 0.
|
| 86 |
color: #94a3b8;
|
|
|
|
|
|
|
| 87 |
}
|
| 88 |
|
| 89 |
/* Quoted Reply inside Bubble */
|
|
@@ -91,14 +142,19 @@
|
|
| 91 |
display: flex;
|
| 92 |
align-items: stretch;
|
| 93 |
gap: 0.5rem;
|
| 94 |
-
background: rgba(0, 0, 0, 0.
|
| 95 |
border-radius: 6px;
|
| 96 |
-
padding: 0.
|
| 97 |
-
margin-bottom: 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
.tg-reply-line {
|
| 101 |
-
width:
|
| 102 |
border-radius: 2px;
|
| 103 |
background: #e07a5f;
|
| 104 |
flex-shrink: 0;
|
|
@@ -106,30 +162,32 @@
|
|
| 106 |
|
| 107 |
.tg-reply-content {
|
| 108 |
overflow: hidden;
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
|
| 111 |
.tg-reply-name {
|
| 112 |
-
font-size: 0.
|
| 113 |
-
font-weight:
|
| 114 |
color: #e07a5f;
|
| 115 |
line-height: 1.2;
|
| 116 |
}
|
| 117 |
|
| 118 |
.tg-reply-text {
|
| 119 |
-
font-size: 0.
|
| 120 |
color: #cbd5e1;
|
| 121 |
white-space: nowrap;
|
| 122 |
overflow: hidden;
|
| 123 |
text-overflow: ellipsis;
|
| 124 |
-
margin-top: 0.
|
| 125 |
}
|
| 126 |
|
| 127 |
/* Media in Bubble */
|
| 128 |
.tg-media-box {
|
| 129 |
-
margin-bottom: 0.
|
| 130 |
border-radius: 8px;
|
| 131 |
overflow: hidden;
|
| 132 |
-
max-height:
|
| 133 |
}
|
| 134 |
|
| 135 |
.tg-media-box.hidden {
|
|
@@ -145,11 +203,12 @@
|
|
| 145 |
|
| 146 |
/* Message Text */
|
| 147 |
.tg-message-text {
|
| 148 |
-
font-size: 0.
|
| 149 |
-
line-height: 1.
|
| 150 |
-
color: #
|
| 151 |
word-break: break-word;
|
| 152 |
white-space: pre-wrap;
|
|
|
|
| 153 |
}
|
| 154 |
|
| 155 |
/* Timestamp & Meta */
|
|
@@ -158,24 +217,27 @@
|
|
| 158 |
align-items: center;
|
| 159 |
justify-content: flex-end;
|
| 160 |
gap: 0.25rem;
|
| 161 |
-
margin-top: 0.
|
| 162 |
color: #94a3b8;
|
| 163 |
-
font-size: 0.
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
.tg-checks {
|
| 167 |
color: #38bdf8;
|
| 168 |
}
|
| 169 |
|
| 170 |
-
/*
|
|
|
|
|
|
|
| 171 |
.generated-box {
|
| 172 |
margin-top: 1.5rem;
|
| 173 |
-
padding: 1.
|
| 174 |
-
background:
|
| 175 |
-
border:
|
| 176 |
border-radius: var(--radius-md);
|
| 177 |
-
box-shadow:
|
| 178 |
-
animation:
|
| 179 |
}
|
| 180 |
|
| 181 |
.generated-box.hidden {
|
|
@@ -186,70 +248,102 @@
|
|
| 186 |
display: flex;
|
| 187 |
align-items: center;
|
| 188 |
justify-content: space-between;
|
| 189 |
-
margin-bottom:
|
|
|
|
| 190 |
}
|
| 191 |
|
| 192 |
.result-badge {
|
| 193 |
display: inline-flex;
|
| 194 |
align-items: center;
|
| 195 |
-
gap: 0.
|
| 196 |
-
font-size: 0.
|
| 197 |
-
font-weight:
|
| 198 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
| 200 |
|
| 201 |
.result-info {
|
| 202 |
-
font-size: 0.
|
| 203 |
-
color: var(--text-
|
| 204 |
font-family: var(--font-mono);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
}
|
| 206 |
|
| 207 |
.result-preview-image-wrap {
|
| 208 |
display: flex;
|
| 209 |
align-items: center;
|
| 210 |
justify-content: center;
|
| 211 |
-
padding:
|
| 212 |
-
background:
|
| 213 |
border-radius: var(--radius-sm);
|
| 214 |
-
border:
|
| 215 |
-
|
|
|
|
| 216 |
}
|
| 217 |
|
| 218 |
.rendered-image {
|
| 219 |
max-width: 100%;
|
| 220 |
-
max-height:
|
| 221 |
object-fit: contain;
|
| 222 |
-
border-radius:
|
| 223 |
-
|
|
|
|
|
|
|
| 224 |
}
|
| 225 |
|
| 226 |
.result-actions {
|
| 227 |
display: flex;
|
| 228 |
-
gap: 0.
|
|
|
|
| 229 |
}
|
| 230 |
|
| 231 |
-
/*
|
|
|
|
|
|
|
| 232 |
.api-playground-box {
|
| 233 |
margin-top: 1.5rem;
|
| 234 |
-
border:
|
| 235 |
border-radius: var(--radius-md);
|
| 236 |
-
background:
|
|
|
|
| 237 |
overflow: hidden;
|
|
|
|
|
|
|
| 238 |
}
|
| 239 |
|
| 240 |
.playground-header {
|
| 241 |
display: flex;
|
| 242 |
align-items: center;
|
| 243 |
justify-content: space-between;
|
| 244 |
-
padding: 0.
|
| 245 |
-
|
| 246 |
-
|
|
|
|
|
|
|
| 247 |
}
|
| 248 |
|
| 249 |
.playground-title {
|
| 250 |
-
font-size: 0.
|
| 251 |
-
font-weight:
|
| 252 |
-
color: var(--text-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
|
| 255 |
.tab-buttons {
|
|
@@ -258,67 +352,106 @@
|
|
| 258 |
}
|
| 259 |
|
| 260 |
.tab-btn {
|
| 261 |
-
background:
|
| 262 |
-
border:
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
font-
|
| 266 |
-
|
| 267 |
-
|
|
|
|
|
|
|
| 268 |
cursor: pointer;
|
| 269 |
-
transition: var(--transition-
|
|
|
|
|
|
|
|
|
|
| 270 |
}
|
| 271 |
|
| 272 |
.tab-btn:hover {
|
| 273 |
-
|
|
|
|
| 274 |
}
|
| 275 |
|
| 276 |
.tab-btn.active {
|
| 277 |
-
background:
|
| 278 |
-
color: #
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
.snippet-viewer {
|
| 283 |
-
position: relative;
|
| 284 |
-
padding: 0.85rem;
|
| 285 |
-
}
|
| 286 |
-
|
| 287 |
-
.code-block {
|
| 288 |
-
display: block;
|
| 289 |
-
font-family: var(--font-mono);
|
| 290 |
-
font-size: 0.75rem;
|
| 291 |
-
line-height: 1.5;
|
| 292 |
-
color: #cbd5e1;
|
| 293 |
-
white-space: pre-wrap;
|
| 294 |
-
word-break: break-all;
|
| 295 |
-
max-height: 150px;
|
| 296 |
-
overflow-y: auto;
|
| 297 |
}
|
| 298 |
|
| 299 |
.copy-snippet-btn {
|
| 300 |
-
position: absolute;
|
| 301 |
-
top: 0.5rem;
|
| 302 |
-
right: 0.5rem;
|
| 303 |
display: inline-flex;
|
| 304 |
align-items: center;
|
| 305 |
-
gap: 0.
|
| 306 |
-
padding: 0.
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
border
|
| 310 |
-
|
| 311 |
-
|
|
|
|
|
|
|
|
|
|
| 312 |
cursor: pointer;
|
| 313 |
-
transition: var(--transition-
|
|
|
|
| 314 |
}
|
| 315 |
|
| 316 |
.copy-snippet-btn:hover {
|
| 317 |
-
background:
|
| 318 |
color: #ffffff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
}
|
|
|
|
| 1 |
+
/* ==========================================================================
|
| 2 |
+
NEUBRUTALISM DESIGN SYSTEM - PREVIEW.CSS
|
| 3 |
+
Live Preview Stage, Simulated Telegram Bubble, and Developer Drawer
|
| 4 |
+
========================================================================== */
|
| 5 |
+
|
| 6 |
+
/* Preview Panel */
|
| 7 |
.preview-panel {
|
| 8 |
position: sticky;
|
| 9 |
top: 1.5rem;
|
| 10 |
+
min-width: 0;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
@media (max-width: 960px) {
|
| 14 |
+
.preview-panel {
|
| 15 |
+
position: static;
|
| 16 |
+
top: auto;
|
| 17 |
+
}
|
| 18 |
}
|
| 19 |
|
| 20 |
+
/* Mode Tag */
|
| 21 |
.preview-mode-tag {
|
| 22 |
+
font-size: 0.78rem;
|
| 23 |
+
font-family: var(--font-mono);
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
padding: 0.3rem 0.65rem;
|
| 26 |
+
border-radius: var(--radius-xs);
|
| 27 |
+
background: var(--color-tertiary);
|
| 28 |
+
color: #ffffff;
|
| 29 |
+
border: var(--border-sm);
|
| 30 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 31 |
text-transform: uppercase;
|
| 32 |
+
letter-spacing: 0.04em;
|
| 33 |
}
|
| 34 |
|
| 35 |
+
/* Live Preview Metadata Strip */
|
| 36 |
+
.preview-meta-strip {
|
| 37 |
+
display: flex;
|
| 38 |
+
align-items: center;
|
| 39 |
+
justify-content: space-between;
|
| 40 |
+
gap: 0.6rem;
|
| 41 |
+
padding: 0.55rem 0.85rem;
|
| 42 |
+
background: var(--bg-nested);
|
| 43 |
+
border-radius: var(--radius-sm);
|
| 44 |
+
border: var(--border-sm);
|
| 45 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 46 |
+
margin-bottom: 0.95rem;
|
| 47 |
+
font-size: 0.78rem;
|
| 48 |
+
font-weight: 700;
|
| 49 |
+
color: var(--text-primary);
|
| 50 |
+
flex-wrap: wrap;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.preview-meta-item strong {
|
| 54 |
+
color: var(--text-primary);
|
| 55 |
+
font-family: var(--font-mono);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/* Telegram Canvas Preview Stage */
|
| 59 |
.preview-stage-container {
|
| 60 |
display: flex;
|
| 61 |
align-items: center;
|
| 62 |
justify-content: center;
|
| 63 |
+
min-height: 230px;
|
| 64 |
+
padding: 2.25rem 1.5rem;
|
| 65 |
+
background: #18202a;
|
| 66 |
border-radius: var(--radius-md);
|
| 67 |
+
border: var(--border-md);
|
| 68 |
+
box-shadow: var(--shadow-md);
|
| 69 |
position: relative;
|
| 70 |
overflow: hidden;
|
| 71 |
+
max-width: 100%;
|
| 72 |
+
min-width: 0;
|
| 73 |
+
transition: min-height 0.2s ease-out;
|
| 74 |
}
|
| 75 |
|
| 76 |
+
/* Telegram Simulated Card (Authentic Telegram Chat Preview) */
|
| 77 |
.telegram-quote-card {
|
| 78 |
display: flex;
|
| 79 |
align-items: flex-start;
|
| 80 |
+
gap: 0.85rem;
|
| 81 |
+
max-width: 490px;
|
| 82 |
width: 100%;
|
| 83 |
+
min-width: 0;
|
| 84 |
}
|
| 85 |
|
| 86 |
.tg-avatar-col {
|
|
|
|
| 92 |
height: 44px;
|
| 93 |
border-radius: 50%;
|
| 94 |
object-fit: cover;
|
| 95 |
+
background: #232b36;
|
| 96 |
+
border: 2px solid rgba(0, 0, 0, 0.4);
|
| 97 |
+
box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
|
| 98 |
}
|
| 99 |
|
| 100 |
.tg-bubble-col {
|
| 101 |
flex: 1;
|
| 102 |
background: #1b1e23;
|
| 103 |
border-radius: 14px 14px 14px 4px;
|
| 104 |
+
padding: 0.75rem 1rem 0.6rem;
|
|
|
|
| 105 |
position: relative;
|
| 106 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
|
| 107 |
+
transition: background-color var(--transition-tactile);
|
| 108 |
+
min-width: 0;
|
| 109 |
}
|
| 110 |
|
| 111 |
.tg-bubble-header {
|
| 112 |
display: flex;
|
| 113 |
align-items: center;
|
| 114 |
gap: 0.5rem;
|
| 115 |
+
margin-bottom: 0.4rem;
|
| 116 |
+
min-width: 0;
|
| 117 |
}
|
| 118 |
|
| 119 |
.tg-sender-name {
|
| 120 |
+
font-size: 0.9rem;
|
| 121 |
+
font-weight: 700;
|
| 122 |
color: #e07a5f;
|
| 123 |
letter-spacing: -0.01em;
|
| 124 |
+
white-space: nowrap;
|
| 125 |
+
overflow: hidden;
|
| 126 |
+
text-overflow: ellipsis;
|
| 127 |
}
|
| 128 |
|
| 129 |
.tg-sender-badge {
|
| 130 |
font-size: 0.65rem;
|
| 131 |
+
font-weight: 700;
|
| 132 |
+
padding: 0.12rem 0.45rem;
|
| 133 |
border-radius: 4px;
|
| 134 |
+
background: rgba(255, 255, 255, 0.15);
|
| 135 |
color: #94a3b8;
|
| 136 |
+
flex-shrink: 0;
|
| 137 |
+
text-transform: uppercase;
|
| 138 |
}
|
| 139 |
|
| 140 |
/* Quoted Reply inside Bubble */
|
|
|
|
| 142 |
display: flex;
|
| 143 |
align-items: stretch;
|
| 144 |
gap: 0.5rem;
|
| 145 |
+
background: rgba(0, 0, 0, 0.25);
|
| 146 |
border-radius: 6px;
|
| 147 |
+
padding: 0.4rem 0.6rem;
|
| 148 |
+
margin-bottom: 0.55rem;
|
| 149 |
+
min-width: 0;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.tg-reply-box.hidden {
|
| 153 |
+
display: none;
|
| 154 |
}
|
| 155 |
|
| 156 |
.tg-reply-line {
|
| 157 |
+
width: 3.5px;
|
| 158 |
border-radius: 2px;
|
| 159 |
background: #e07a5f;
|
| 160 |
flex-shrink: 0;
|
|
|
|
| 162 |
|
| 163 |
.tg-reply-content {
|
| 164 |
overflow: hidden;
|
| 165 |
+
min-width: 0;
|
| 166 |
+
flex: 1;
|
| 167 |
}
|
| 168 |
|
| 169 |
.tg-reply-name {
|
| 170 |
+
font-size: 0.76rem;
|
| 171 |
+
font-weight: 700;
|
| 172 |
color: #e07a5f;
|
| 173 |
line-height: 1.2;
|
| 174 |
}
|
| 175 |
|
| 176 |
.tg-reply-text {
|
| 177 |
+
font-size: 0.74rem;
|
| 178 |
color: #cbd5e1;
|
| 179 |
white-space: nowrap;
|
| 180 |
overflow: hidden;
|
| 181 |
text-overflow: ellipsis;
|
| 182 |
+
margin-top: 0.15rem;
|
| 183 |
}
|
| 184 |
|
| 185 |
/* Media in Bubble */
|
| 186 |
.tg-media-box {
|
| 187 |
+
margin-bottom: 0.55rem;
|
| 188 |
border-radius: 8px;
|
| 189 |
overflow: hidden;
|
| 190 |
+
max-height: 240px;
|
| 191 |
}
|
| 192 |
|
| 193 |
.tg-media-box.hidden {
|
|
|
|
| 203 |
|
| 204 |
/* Message Text */
|
| 205 |
.tg-message-text {
|
| 206 |
+
font-size: 0.88rem;
|
| 207 |
+
line-height: 1.5;
|
| 208 |
+
color: #f8fafc;
|
| 209 |
word-break: break-word;
|
| 210 |
white-space: pre-wrap;
|
| 211 |
+
font-weight: 500;
|
| 212 |
}
|
| 213 |
|
| 214 |
/* Timestamp & Meta */
|
|
|
|
| 217 |
align-items: center;
|
| 218 |
justify-content: flex-end;
|
| 219 |
gap: 0.25rem;
|
| 220 |
+
margin-top: 0.35rem;
|
| 221 |
color: #94a3b8;
|
| 222 |
+
font-size: 0.7rem;
|
| 223 |
+
font-weight: 600;
|
| 224 |
}
|
| 225 |
|
| 226 |
.tg-checks {
|
| 227 |
color: #38bdf8;
|
| 228 |
}
|
| 229 |
|
| 230 |
+
/* ==========================================================================
|
| 231 |
+
GENERATED SERVER RESULT CARD (NEUBRUTAL RESULT)
|
| 232 |
+
========================================================================== */
|
| 233 |
.generated-box {
|
| 234 |
margin-top: 1.5rem;
|
| 235 |
+
padding: 1.5rem;
|
| 236 |
+
background: var(--bg-card);
|
| 237 |
+
border: var(--border-md);
|
| 238 |
border-radius: var(--radius-md);
|
| 239 |
+
box-shadow: var(--shadow-lg);
|
| 240 |
+
animation: neubrutalFadeIn 0.25s ease-out;
|
| 241 |
}
|
| 242 |
|
| 243 |
.generated-box.hidden {
|
|
|
|
| 248 |
display: flex;
|
| 249 |
align-items: center;
|
| 250 |
justify-content: space-between;
|
| 251 |
+
margin-bottom: 1.15rem;
|
| 252 |
+
gap: 0.5rem;
|
| 253 |
}
|
| 254 |
|
| 255 |
.result-badge {
|
| 256 |
display: inline-flex;
|
| 257 |
align-items: center;
|
| 258 |
+
gap: 0.5rem;
|
| 259 |
+
font-size: 0.85rem;
|
| 260 |
+
font-weight: 800;
|
| 261 |
+
color: #000000;
|
| 262 |
+
background: var(--color-accent-green);
|
| 263 |
+
border: var(--border-sm);
|
| 264 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 265 |
+
padding: 0.3rem 0.65rem;
|
| 266 |
+
border-radius: var(--radius-xs);
|
| 267 |
+
text-transform: uppercase;
|
| 268 |
}
|
| 269 |
|
| 270 |
.result-info {
|
| 271 |
+
font-size: 0.78rem;
|
| 272 |
+
color: var(--text-primary);
|
| 273 |
font-family: var(--font-mono);
|
| 274 |
+
font-weight: 700;
|
| 275 |
+
background: var(--bg-nested);
|
| 276 |
+
padding: 0.25rem 0.55rem;
|
| 277 |
+
border: 1.5px solid var(--border-color);
|
| 278 |
+
border-radius: var(--radius-xs);
|
| 279 |
}
|
| 280 |
|
| 281 |
.result-preview-image-wrap {
|
| 282 |
display: flex;
|
| 283 |
align-items: center;
|
| 284 |
justify-content: center;
|
| 285 |
+
padding: 1.25rem;
|
| 286 |
+
background: var(--bg-nested);
|
| 287 |
border-radius: var(--radius-sm);
|
| 288 |
+
border: var(--border-sm);
|
| 289 |
+
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
|
| 290 |
+
margin-bottom: 1.25rem;
|
| 291 |
}
|
| 292 |
|
| 293 |
.rendered-image {
|
| 294 |
max-width: 100%;
|
| 295 |
+
max-height: 400px;
|
| 296 |
object-fit: contain;
|
| 297 |
+
border-radius: var(--radius-xs);
|
| 298 |
+
border: var(--border-sm);
|
| 299 |
+
box-shadow: var(--shadow-sm);
|
| 300 |
+
background: transparent;
|
| 301 |
}
|
| 302 |
|
| 303 |
.result-actions {
|
| 304 |
display: flex;
|
| 305 |
+
gap: 0.85rem;
|
| 306 |
+
flex-wrap: wrap;
|
| 307 |
}
|
| 308 |
|
| 309 |
+
/* ==========================================================================
|
| 310 |
+
DEVELOPER PLAYGROUND & CODE DRAWER
|
| 311 |
+
========================================================================== */
|
| 312 |
.api-playground-box {
|
| 313 |
margin-top: 1.5rem;
|
| 314 |
+
border: var(--border-md);
|
| 315 |
border-radius: var(--radius-md);
|
| 316 |
+
background: var(--bg-card);
|
| 317 |
+
box-shadow: var(--shadow-md);
|
| 318 |
overflow: hidden;
|
| 319 |
+
min-width: 0;
|
| 320 |
+
max-width: 100%;
|
| 321 |
}
|
| 322 |
|
| 323 |
.playground-header {
|
| 324 |
display: flex;
|
| 325 |
align-items: center;
|
| 326 |
justify-content: space-between;
|
| 327 |
+
padding: 0.65rem 1rem;
|
| 328 |
+
border-bottom: var(--border-sm);
|
| 329 |
+
background: var(--bg-nested);
|
| 330 |
+
gap: 0.75rem;
|
| 331 |
+
flex-wrap: wrap;
|
| 332 |
}
|
| 333 |
|
| 334 |
.playground-title {
|
| 335 |
+
font-size: 0.82rem;
|
| 336 |
+
font-weight: 800;
|
| 337 |
+
color: var(--text-primary);
|
| 338 |
+
text-transform: uppercase;
|
| 339 |
+
letter-spacing: 0.04em;
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
.playground-actions {
|
| 343 |
+
display: flex;
|
| 344 |
+
align-items: center;
|
| 345 |
+
gap: 0.65rem;
|
| 346 |
+
flex-wrap: wrap;
|
| 347 |
}
|
| 348 |
|
| 349 |
.tab-buttons {
|
|
|
|
| 352 |
}
|
| 353 |
|
| 354 |
.tab-btn {
|
| 355 |
+
background: var(--bg-card);
|
| 356 |
+
border: var(--border-sm);
|
| 357 |
+
box-shadow: 1.5px 1.5px 0px var(--shadow-color);
|
| 358 |
+
color: var(--text-primary);
|
| 359 |
+
font-size: 0.78rem;
|
| 360 |
+
font-weight: 800;
|
| 361 |
+
padding: 0.35rem 0.75rem;
|
| 362 |
+
min-height: 36px;
|
| 363 |
+
border-radius: var(--radius-xs);
|
| 364 |
cursor: pointer;
|
| 365 |
+
transition: all var(--transition-tactile);
|
| 366 |
+
display: inline-flex;
|
| 367 |
+
align-items: center;
|
| 368 |
+
justify-content: center;
|
| 369 |
}
|
| 370 |
|
| 371 |
.tab-btn:hover {
|
| 372 |
+
background: var(--color-primary);
|
| 373 |
+
color: #000000;
|
| 374 |
}
|
| 375 |
|
| 376 |
.tab-btn.active {
|
| 377 |
+
background: var(--color-primary);
|
| 378 |
+
color: #000000;
|
| 379 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 380 |
+
transform: translate(-1px, -1px);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
}
|
| 382 |
|
| 383 |
.copy-snippet-btn {
|
|
|
|
|
|
|
|
|
|
| 384 |
display: inline-flex;
|
| 385 |
align-items: center;
|
| 386 |
+
gap: 0.4rem;
|
| 387 |
+
padding: 0.35rem 0.75rem;
|
| 388 |
+
min-height: 36px;
|
| 389 |
+
background: var(--bg-card);
|
| 390 |
+
border: var(--border-sm);
|
| 391 |
+
border-radius: var(--radius-xs);
|
| 392 |
+
box-shadow: 1.5px 1.5px 0px var(--shadow-color);
|
| 393 |
+
color: var(--text-primary);
|
| 394 |
+
font-size: 0.78rem;
|
| 395 |
+
font-weight: 800;
|
| 396 |
cursor: pointer;
|
| 397 |
+
transition: all var(--transition-tactile);
|
| 398 |
+
white-space: nowrap;
|
| 399 |
}
|
| 400 |
|
| 401 |
.copy-snippet-btn:hover {
|
| 402 |
+
background: var(--color-tertiary);
|
| 403 |
color: #ffffff;
|
| 404 |
+
transform: translate(-1px, -1px);
|
| 405 |
+
box-shadow: 2px 2px 0px var(--shadow-color);
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
.copy-snippet-btn:active {
|
| 409 |
+
transform: translate(1px, 1px);
|
| 410 |
+
box-shadow: 0px 0px 0px var(--shadow-color);
|
| 411 |
}
|
| 412 |
|
| 413 |
+
.snippet-viewer {
|
| 414 |
+
padding: 0;
|
| 415 |
+
background: #090c10;
|
| 416 |
+
border-top: var(--border-sm);
|
| 417 |
+
min-width: 0;
|
| 418 |
+
max-width: 100%;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
.code-block {
|
| 422 |
+
display: block;
|
| 423 |
+
font-family: var(--font-mono);
|
| 424 |
+
font-size: 0.8rem;
|
| 425 |
+
line-height: 1.6;
|
| 426 |
+
color: #e2e8f0;
|
| 427 |
+
white-space: pre;
|
| 428 |
+
overflow-x: auto;
|
| 429 |
+
overflow-y: auto;
|
| 430 |
+
max-height: 240px;
|
| 431 |
+
padding: 1rem 1.25rem;
|
| 432 |
+
max-width: 100%;
|
| 433 |
+
-webkit-overflow-scrolling: touch;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
@media (max-width: 640px) {
|
| 437 |
+
.preview-stage-container {
|
| 438 |
+
padding: 1.5rem 0.85rem;
|
| 439 |
+
min-height: 190px;
|
| 440 |
+
}
|
| 441 |
+
.tg-avatar {
|
| 442 |
+
width: 38px;
|
| 443 |
+
height: 38px;
|
| 444 |
+
}
|
| 445 |
+
.telegram-quote-card {
|
| 446 |
+
gap: 0.65rem;
|
| 447 |
+
}
|
| 448 |
+
.tg-bubble-col {
|
| 449 |
+
padding: 0.65rem 0.85rem 0.55rem;
|
| 450 |
+
}
|
| 451 |
+
.result-actions .btn-secondary,
|
| 452 |
+
.result-actions .btn-outline {
|
| 453 |
+
flex: 1;
|
| 454 |
+
min-width: 140px;
|
| 455 |
+
justify-content: center;
|
| 456 |
+
}
|
| 457 |
}
|
frontend/vercel.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
| 1 |
{
|
| 2 |
"$schema": "https://openapi.vercel.sh/vercel.json",
|
| 3 |
"rewrites": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
{
|
| 5 |
"source": "/api/generate",
|
| 6 |
"destination": "https://ilhamdev-quote-api.hf.space/"
|
|
@@ -8,19 +16,39 @@
|
|
| 8 |
{
|
| 9 |
"source": "/api/status",
|
| 10 |
"destination": "https://ilhamdev-quote-api.hf.space/status"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
}
|
| 12 |
],
|
| 13 |
"headers": [
|
| 14 |
{
|
| 15 |
"source": "/(.*)",
|
| 16 |
"headers": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
{
|
| 18 |
"key": "X-Content-Type-Options",
|
| 19 |
"value": "nosniff"
|
| 20 |
},
|
| 21 |
{
|
| 22 |
"key": "X-Frame-Options",
|
| 23 |
-
"value": "
|
| 24 |
},
|
| 25 |
{
|
| 26 |
"key": "X-XSS-Protection",
|
|
|
|
| 1 |
{
|
| 2 |
"$schema": "https://openapi.vercel.sh/vercel.json",
|
| 3 |
"rewrites": [
|
| 4 |
+
{
|
| 5 |
+
"source": "/generate",
|
| 6 |
+
"destination": "https://ilhamdev-quote-api.hf.space/"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"source": "/status",
|
| 10 |
+
"destination": "https://ilhamdev-quote-api.hf.space/status"
|
| 11 |
+
},
|
| 12 |
{
|
| 13 |
"source": "/api/generate",
|
| 14 |
"destination": "https://ilhamdev-quote-api.hf.space/"
|
|
|
|
| 16 |
{
|
| 17 |
"source": "/api/status",
|
| 18 |
"destination": "https://ilhamdev-quote-api.hf.space/status"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"source": "/api",
|
| 22 |
+
"destination": "https://ilhamdev-quote-api.hf.space/"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"source": "/api/:path*",
|
| 26 |
+
"destination": "https://ilhamdev-quote-api.hf.space/:path*"
|
| 27 |
}
|
| 28 |
],
|
| 29 |
"headers": [
|
| 30 |
{
|
| 31 |
"source": "/(.*)",
|
| 32 |
"headers": [
|
| 33 |
+
{
|
| 34 |
+
"key": "Access-Control-Allow-Origin",
|
| 35 |
+
"value": "*"
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"key": "Access-Control-Allow-Methods",
|
| 39 |
+
"value": "GET, POST, OPTIONS"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"key": "Access-Control-Allow-Headers",
|
| 43 |
+
"value": "Content-Type, Authorization, X-Requested-With"
|
| 44 |
+
},
|
| 45 |
{
|
| 46 |
"key": "X-Content-Type-Options",
|
| 47 |
"value": "nosniff"
|
| 48 |
},
|
| 49 |
{
|
| 50 |
"key": "X-Frame-Options",
|
| 51 |
+
"value": "SAMEORIGIN"
|
| 52 |
},
|
| 53 |
{
|
| 54 |
"key": "X-XSS-Protection",
|
frontend/vite.config.js
CHANGED
|
@@ -4,6 +4,11 @@ export default defineConfig({
|
|
| 4 |
server: {
|
| 5 |
port: 5173,
|
| 6 |
proxy: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
'/api': {
|
| 8 |
target: 'https://ilhamdev-quote-api.hf.space',
|
| 9 |
changeOrigin: true,
|
|
|
|
| 4 |
server: {
|
| 5 |
port: 5173,
|
| 6 |
proxy: {
|
| 7 |
+
'/generate': {
|
| 8 |
+
target: 'https://ilhamdev-quote-api.hf.space',
|
| 9 |
+
changeOrigin: true,
|
| 10 |
+
rewrite: () => '/',
|
| 11 |
+
},
|
| 12 |
'/api': {
|
| 13 |
target: 'https://ilhamdev-quote-api.hf.space',
|
| 14 |
changeOrigin: true,
|
middleware.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Vercel Edge Middleware
|
| 3 |
+
* Enables POST requests directly on qc.mangrusdi.my.id (POST /, POST /generate, POST /api)
|
| 4 |
+
* with IP forwarding, status caching, and rate limit shield for Hugging Face Space.
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
const BACKEND_URL = 'https://ilhamdev-quote-api.hf.space';
|
| 8 |
+
|
| 9 |
+
export const config = {
|
| 10 |
+
matcher: ['/', '/generate', '/status', '/api/:path*'],
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
// Edge cache for /status to reduce Hugging Face wakeups and pings
|
| 14 |
+
let cachedStatusBody = null;
|
| 15 |
+
let cachedStatusTime = 0;
|
| 16 |
+
const STATUS_CACHE_TTL_MS = 15000; // 15 seconds
|
| 17 |
+
|
| 18 |
+
// Edge rate limiting: max 35 POST requests per minute per IP
|
| 19 |
+
const edgeRateLimits = new Map();
|
| 20 |
+
const RATE_WINDOW_MS = 60000;
|
| 21 |
+
const MAX_EDGE_REQUESTS = 35;
|
| 22 |
+
|
| 23 |
+
function isEdgeRateLimited(ip) {
|
| 24 |
+
if (!ip) return false;
|
| 25 |
+
const now = Date.now();
|
| 26 |
+
let history = edgeRateLimits.get(ip) || [];
|
| 27 |
+
history = history.filter(t => now - t < RATE_WINDOW_MS);
|
| 28 |
+
if (history.length >= MAX_EDGE_REQUESTS) {
|
| 29 |
+
edgeRateLimits.set(ip, history);
|
| 30 |
+
return true;
|
| 31 |
+
}
|
| 32 |
+
history.push(now);
|
| 33 |
+
edgeRateLimits.set(ip, history);
|
| 34 |
+
return false;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
export default async function middleware(request) {
|
| 38 |
+
const url = new URL(request.url);
|
| 39 |
+
const clientIp = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ||
|
| 40 |
+
request.headers.get('x-real-ip') ||
|
| 41 |
+
'anonymous';
|
| 42 |
+
|
| 43 |
+
// 1. CORS Preflight Support
|
| 44 |
+
if (request.method === 'OPTIONS') {
|
| 45 |
+
return new Response(null, {
|
| 46 |
+
status: 204,
|
| 47 |
+
headers: {
|
| 48 |
+
'Access-Control-Allow-Origin': '*',
|
| 49 |
+
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
| 50 |
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-Requested-With',
|
| 51 |
+
},
|
| 52 |
+
});
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// 2. Health Check (/status or /api/status) with Edge Caching
|
| 56 |
+
if (url.pathname === '/status' || url.pathname === '/api/status') {
|
| 57 |
+
const now = Date.now();
|
| 58 |
+
if (cachedStatusBody && (now - cachedStatusTime) < STATUS_CACHE_TTL_MS) {
|
| 59 |
+
return new Response(cachedStatusBody, {
|
| 60 |
+
status: 200,
|
| 61 |
+
headers: {
|
| 62 |
+
'Content-Type': 'application/json',
|
| 63 |
+
'Access-Control-Allow-Origin': '*',
|
| 64 |
+
'X-Edge-Cache': 'HIT',
|
| 65 |
+
},
|
| 66 |
+
});
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
try {
|
| 70 |
+
const res = await fetch(`${BACKEND_URL}/status`);
|
| 71 |
+
const body = await res.text();
|
| 72 |
+
if (res.ok) {
|
| 73 |
+
cachedStatusBody = body;
|
| 74 |
+
cachedStatusTime = now;
|
| 75 |
+
}
|
| 76 |
+
return new Response(body, {
|
| 77 |
+
status: res.status,
|
| 78 |
+
headers: {
|
| 79 |
+
'Content-Type': 'application/json',
|
| 80 |
+
'Access-Control-Allow-Origin': '*',
|
| 81 |
+
'X-Edge-Cache': 'MISS',
|
| 82 |
+
},
|
| 83 |
+
});
|
| 84 |
+
} catch (err) {
|
| 85 |
+
return new Response(JSON.stringify({ status: false, message: 'Backend unreachable' }), {
|
| 86 |
+
status: 502,
|
| 87 |
+
headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' },
|
| 88 |
+
});
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// 3. Direct POST Requests (e.g. POST /, POST /generate, POST /api/generate)
|
| 93 |
+
if (request.method === 'POST') {
|
| 94 |
+
// Edge Rate Limiting Shield
|
| 95 |
+
if (isEdgeRateLimited(clientIp)) {
|
| 96 |
+
return new Response(
|
| 97 |
+
JSON.stringify({
|
| 98 |
+
status: false,
|
| 99 |
+
message: 'Rate limit exceeded (35 req/min). Hugging Face Space capacity protection active.',
|
| 100 |
+
retryAfter: 60,
|
| 101 |
+
}),
|
| 102 |
+
{
|
| 103 |
+
status: 429,
|
| 104 |
+
headers: {
|
| 105 |
+
'Content-Type': 'application/json',
|
| 106 |
+
'Access-Control-Allow-Origin': '*',
|
| 107 |
+
'Retry-After': '60',
|
| 108 |
+
},
|
| 109 |
+
}
|
| 110 |
+
);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
try {
|
| 114 |
+
const requestBody = await request.text();
|
| 115 |
+
const headers = new Headers();
|
| 116 |
+
headers.set('Content-Type', request.headers.get('content-type') || 'application/json');
|
| 117 |
+
headers.set('x-forwarded-for', request.headers.get('x-forwarded-for') || clientIp);
|
| 118 |
+
headers.set('x-real-ip', clientIp);
|
| 119 |
+
|
| 120 |
+
const response = await fetch(`${BACKEND_URL}/`, {
|
| 121 |
+
method: 'POST',
|
| 122 |
+
headers: headers,
|
| 123 |
+
body: requestBody,
|
| 124 |
+
});
|
| 125 |
+
|
| 126 |
+
const responseData = await response.text();
|
| 127 |
+
|
| 128 |
+
return new Response(responseData, {
|
| 129 |
+
status: response.status,
|
| 130 |
+
headers: {
|
| 131 |
+
'Content-Type': 'application/json',
|
| 132 |
+
'Access-Control-Allow-Origin': '*',
|
| 133 |
+
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
| 134 |
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
| 135 |
+
'Cache-Control': response.headers.get('cache-control') || 'public, max-age=1800',
|
| 136 |
+
},
|
| 137 |
+
});
|
| 138 |
+
} catch (err) {
|
| 139 |
+
return new Response(JSON.stringify({ status: false, message: `Proxy error: ${err.message}` }), {
|
| 140 |
+
status: 502,
|
| 141 |
+
headers: {
|
| 142 |
+
'Content-Type': 'application/json',
|
| 143 |
+
'Access-Control-Allow-Origin': '*',
|
| 144 |
+
},
|
| 145 |
+
});
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
// 4. Fall through for GET / to serve the static Vite web application
|
| 150 |
+
}
|
package.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
| 6 |
"type": "module",
|
| 7 |
"scripts": {
|
| 8 |
"start": "bun run src/index.js",
|
| 9 |
-
"dev": "bun run --watch src/index.js"
|
|
|
|
| 10 |
},
|
| 11 |
"repository": {
|
| 12 |
"type": "git",
|
|
|
|
| 6 |
"type": "module",
|
| 7 |
"scripts": {
|
| 8 |
"start": "bun run src/index.js",
|
| 9 |
+
"dev": "bun run --watch src/index.js",
|
| 10 |
+
"build": "npm --prefix frontend run build"
|
| 11 |
},
|
| 12 |
"repository": {
|
| 13 |
"type": "git",
|
public/favicon.png
CHANGED
|
|
Git LFS Details
|
|
|
Git LFS Details
|
public/og-image.png
ADDED
|
Git LFS Details
|
public/robots.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
User-agent: *
|
| 2 |
+
Allow: /
|
| 3 |
+
|
| 4 |
+
Sitemap: https://qc.mangrusdi.my.id/sitemap.xml
|
public/sitemap.xml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
| 3 |
+
<url>
|
| 4 |
+
<loc>https://qc.mangrusdi.my.id/</loc>
|
| 5 |
+
<lastmod>2026-10-08</lastmod>
|
| 6 |
+
<changefreq>weekly</changefreq>
|
| 7 |
+
<priority>1.0</priority>
|
| 8 |
+
</url>
|
| 9 |
+
<url>
|
| 10 |
+
<loc>https://qc.mangrusdi.my.id/generate</loc>
|
| 11 |
+
<lastmod>2026-10-08</lastmod>
|
| 12 |
+
<changefreq>monthly</changefreq>
|
| 13 |
+
<priority>0.8</priority>
|
| 14 |
+
</url>
|
| 15 |
+
<url>
|
| 16 |
+
<loc>https://qc.mangrusdi.my.id/status</loc>
|
| 17 |
+
<lastmod>2026-10-08</lastmod>
|
| 18 |
+
<changefreq>monthly</changefreq>
|
| 19 |
+
<priority>0.5</priority>
|
| 20 |
+
</url>
|
| 21 |
+
</urlset>
|
src/index.js
CHANGED
|
@@ -13,20 +13,49 @@ import getClientIP from './utils/getClientIp.js';
|
|
| 13 |
|
| 14 |
const app = new Hono();
|
| 15 |
|
| 16 |
-
const defaultTtl = 60 * 60 * 1000;
|
| 17 |
|
| 18 |
const inflight = new Map();
|
| 19 |
const cache = cm.createCache({ ttl: defaultTtl });
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
try {
|
| 23 |
const data = await Quote(body);
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
await cache.set(key, result);
|
| 28 |
-
|
| 29 |
-
return result;
|
| 30 |
} finally {
|
| 31 |
inflight.delete(key);
|
| 32 |
}
|
|
@@ -107,52 +136,105 @@ app.get('/', async c => {
|
|
| 107 |
|
| 108 |
app.post('/', async c => {
|
| 109 |
try {
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
return c.json({ status: false, message: 'Content-Type must be application/json' }, 400);
|
| 112 |
}
|
| 113 |
|
| 114 |
const body = await c.req.json();
|
| 115 |
|
| 116 |
-
//
|
| 117 |
if (!body.messages) return c.json({ status: false, message: 'messages is required' }, 400);
|
| 118 |
if (!Array.isArray(body.messages)) return c.json({ status: false, message: 'messages must be an array' }, 400);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
if (typeof body.messages[0] !== 'object') {
|
| 120 |
return c.json({ status: false, message: 'messages must be an array of objects' }, 400);
|
| 121 |
}
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
const key = Bun.CryptoHasher.hash("sha256", JSON.stringify(body)).toString('hex');
|
| 124 |
|
| 125 |
const cached = await cache.get(key);
|
| 126 |
if (cached !== undefined) {
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
| 129 |
}
|
| 130 |
|
| 131 |
if (inflight.has(key)) {
|
| 132 |
-
const
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
-
const promise = queue.push({ key,
|
| 138 |
inflight.set(key, promise);
|
| 139 |
|
| 140 |
-
const
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
|
|
|
|
|
|
| 144 |
} catch (e) {
|
| 145 |
console.error(e);
|
| 146 |
-
return c.json({ status: false, message: 'Invalid JSON' }, 400);
|
| 147 |
}
|
| 148 |
});
|
| 149 |
|
| 150 |
app.get('/status', c => {
|
| 151 |
const uptime = process.uptime();
|
|
|
|
| 152 |
return c.json({
|
| 153 |
status: true,
|
| 154 |
message: 'Quote API is running',
|
| 155 |
uptime: new Date(uptime * 1000).toISOString().slice(11, 19),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
});
|
| 157 |
});
|
| 158 |
|
|
|
|
| 13 |
|
| 14 |
const app = new Hono();
|
| 15 |
|
| 16 |
+
const defaultTtl = 60 * 60 * 1000; // 1 hour
|
| 17 |
|
| 18 |
const inflight = new Map();
|
| 19 |
const cache = cm.createCache({ ttl: defaultTtl });
|
| 20 |
|
| 21 |
+
// Rate Limiter: 30 requests per minute per IP to protect public Hugging Face Space
|
| 22 |
+
const RATE_LIMIT_WINDOW_MS = 60 * 1000;
|
| 23 |
+
const MAX_REQUESTS_PER_WINDOW = 30;
|
| 24 |
+
const ipRequestHistory = new Map();
|
| 25 |
+
|
| 26 |
+
// Periodic cleanup of rate limit history
|
| 27 |
+
setInterval(() => {
|
| 28 |
+
const now = Date.now();
|
| 29 |
+
for (const [ip, timestamps] of ipRequestHistory.entries()) {
|
| 30 |
+
const valid = timestamps.filter(t => now - t < RATE_LIMIT_WINDOW_MS);
|
| 31 |
+
if (valid.length === 0) {
|
| 32 |
+
ipRequestHistory.delete(ip);
|
| 33 |
+
} else {
|
| 34 |
+
ipRequestHistory.set(ip, valid);
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
}, 2 * 60 * 1000);
|
| 38 |
+
|
| 39 |
+
function isRateLimited(ip) {
|
| 40 |
+
if (!ip) return false;
|
| 41 |
+
const now = Date.now();
|
| 42 |
+
let timestamps = ipRequestHistory.get(ip) || [];
|
| 43 |
+
timestamps = timestamps.filter(t => now - t < RATE_LIMIT_WINDOW_MS);
|
| 44 |
+
if (timestamps.length >= MAX_REQUESTS_PER_WINDOW) {
|
| 45 |
+
ipRequestHistory.set(ip, timestamps);
|
| 46 |
+
return true;
|
| 47 |
+
}
|
| 48 |
+
timestamps.push(now);
|
| 49 |
+
ipRequestHistory.set(ip, timestamps);
|
| 50 |
+
return false;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// Queue Concurrency 4 with backpressure limit of 8 pending jobs
|
| 54 |
+
const queue = fastq.promise(async ({ key, body }) => {
|
| 55 |
try {
|
| 56 |
const data = await Quote(body);
|
| 57 |
+
await cache.set(key, data);
|
| 58 |
+
return data;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
} finally {
|
| 60 |
inflight.delete(key);
|
| 61 |
}
|
|
|
|
| 136 |
|
| 137 |
app.post('/', async c => {
|
| 138 |
try {
|
| 139 |
+
const ipClient = getClientIP(c);
|
| 140 |
+
|
| 141 |
+
// 1. IP Rate Limiting Guard (protect Hugging Face compute)
|
| 142 |
+
if (isRateLimited(ipClient)) {
|
| 143 |
+
return c.json({
|
| 144 |
+
status: false,
|
| 145 |
+
message: 'Rate limit exceeded (30 requests/minute). Hugging Face Space capacity protection active.',
|
| 146 |
+
retryAfter: 60,
|
| 147 |
+
}, 429, {
|
| 148 |
+
'Retry-After': '60',
|
| 149 |
+
'Cache-Control': 'no-store',
|
| 150 |
+
});
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
// 2. Queue Backpressure Guard (protect against CPU & OOM exhaustion)
|
| 154 |
+
if (queue.length() > 8) {
|
| 155 |
+
return c.json({
|
| 156 |
+
status: false,
|
| 157 |
+
message: 'Server rendering engine is currently under heavy load. Please retry in 5 seconds.',
|
| 158 |
+
}, 503, {
|
| 159 |
+
'Retry-After': '5',
|
| 160 |
+
'Cache-Control': 'no-store',
|
| 161 |
+
});
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
if (c.req.header('content-type') && !c.req.header('content-type').includes('application/json')) {
|
| 165 |
return c.json({ status: false, message: 'Content-Type must be application/json' }, 400);
|
| 166 |
}
|
| 167 |
|
| 168 |
const body = await c.req.json();
|
| 169 |
|
| 170 |
+
// 3. Body Validation & Resource Protection
|
| 171 |
if (!body.messages) return c.json({ status: false, message: 'messages is required' }, 400);
|
| 172 |
if (!Array.isArray(body.messages)) return c.json({ status: false, message: 'messages must be an array' }, 400);
|
| 173 |
+
if (body.messages.length === 0) return c.json({ status: false, message: 'messages cannot be empty' }, 400);
|
| 174 |
+
if (body.messages.length > 8) {
|
| 175 |
+
return c.json({ status: false, message: 'Exceeded maximum message count (max 8 messages per quote)' }, 400);
|
| 176 |
+
}
|
| 177 |
if (typeof body.messages[0] !== 'object') {
|
| 178 |
return c.json({ status: false, message: 'messages must be an array of objects' }, 400);
|
| 179 |
}
|
| 180 |
|
| 181 |
+
// Protect string length to prevent memory bombs
|
| 182 |
+
for (const msg of body.messages) {
|
| 183 |
+
if (msg?.text && typeof msg.text === 'string' && msg.text.length > 3000) {
|
| 184 |
+
return c.json({ status: false, message: 'Message text exceeds 3000 characters limit' }, 400);
|
| 185 |
+
}
|
| 186 |
+
if (msg?.from?.photo?.url && typeof msg.from.photo.url === 'string' && msg.from.photo.url.length > 6000000) {
|
| 187 |
+
return c.json({ status: false, message: 'Avatar image payload exceeds 6MB limit' }, 400);
|
| 188 |
+
}
|
| 189 |
+
if (msg?.media?.url && typeof msg.media.url === 'string' && msg.media.url.length > 6000000) {
|
| 190 |
+
return c.json({ status: false, message: 'Media attachment payload exceeds 6MB limit' }, 400);
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
const key = Bun.CryptoHasher.hash("sha256", JSON.stringify(body)).toString('hex');
|
| 195 |
|
| 196 |
const cached = await cache.get(key);
|
| 197 |
if (cached !== undefined) {
|
| 198 |
+
return c.json(cached, 200, {
|
| 199 |
+
'X-Cache': 'HIT',
|
| 200 |
+
'Cache-Control': 'public, max-age=3600',
|
| 201 |
+
});
|
| 202 |
}
|
| 203 |
|
| 204 |
if (inflight.has(key)) {
|
| 205 |
+
const inflightData = await inflight.get(key);
|
| 206 |
+
return c.json(inflightData, 200, {
|
| 207 |
+
'X-Cache': 'HIT',
|
| 208 |
+
'Cache-Control': 'public, max-age=3600',
|
| 209 |
+
});
|
| 210 |
}
|
| 211 |
|
| 212 |
+
const promise = queue.push({ key, body });
|
| 213 |
inflight.set(key, promise);
|
| 214 |
|
| 215 |
+
const resultData = await promise;
|
| 216 |
|
| 217 |
+
return c.json(resultData, 200, {
|
| 218 |
+
'X-Cache': 'MISS',
|
| 219 |
+
'Cache-Control': 'public, max-age=3600',
|
| 220 |
+
});
|
| 221 |
} catch (e) {
|
| 222 |
console.error(e);
|
| 223 |
+
return c.json({ status: false, message: 'Invalid JSON or rendering error' }, 400);
|
| 224 |
}
|
| 225 |
});
|
| 226 |
|
| 227 |
app.get('/status', c => {
|
| 228 |
const uptime = process.uptime();
|
| 229 |
+
const mem = process.memoryUsage();
|
| 230 |
return c.json({
|
| 231 |
status: true,
|
| 232 |
message: 'Quote API is running',
|
| 233 |
uptime: new Date(uptime * 1000).toISOString().slice(11, 19),
|
| 234 |
+
queueWaiting: queue.length(),
|
| 235 |
+
memoryMb: Math.round(mem.rss / 1024 / 1024),
|
| 236 |
+
}, 200, {
|
| 237 |
+
'Cache-Control': 'public, max-age=10',
|
| 238 |
});
|
| 239 |
});
|
| 240 |
|
vercel.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://openapi.vercel.sh/vercel.json",
|
| 3 |
+
"installCommand": "npm --prefix frontend install",
|
| 4 |
+
"buildCommand": "npm --prefix frontend run build",
|
| 5 |
+
"outputDirectory": "frontend/dist",
|
| 6 |
+
"rewrites": [
|
| 7 |
+
{
|
| 8 |
+
"source": "/generate",
|
| 9 |
+
"destination": "https://ilhamdev-quote-api.hf.space/"
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"source": "/status",
|
| 13 |
+
"destination": "https://ilhamdev-quote-api.hf.space/status"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"source": "/api/generate",
|
| 17 |
+
"destination": "https://ilhamdev-quote-api.hf.space/"
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"source": "/api/status",
|
| 21 |
+
"destination": "https://ilhamdev-quote-api.hf.space/status"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"source": "/api",
|
| 25 |
+
"destination": "https://ilhamdev-quote-api.hf.space/"
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"source": "/api/:path*",
|
| 29 |
+
"destination": "https://ilhamdev-quote-api.hf.space/:path*"
|
| 30 |
+
}
|
| 31 |
+
],
|
| 32 |
+
"headers": [
|
| 33 |
+
{
|
| 34 |
+
"source": "/(.*)",
|
| 35 |
+
"headers": [
|
| 36 |
+
{
|
| 37 |
+
"key": "Access-Control-Allow-Origin",
|
| 38 |
+
"value": "*"
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"key": "Access-Control-Allow-Methods",
|
| 42 |
+
"value": "GET, POST, OPTIONS"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"key": "Access-Control-Allow-Headers",
|
| 46 |
+
"value": "Content-Type, Authorization, X-Requested-With"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"key": "X-Content-Type-Options",
|
| 50 |
+
"value": "nosniff"
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"key": "X-Frame-Options",
|
| 54 |
+
"value": "SAMEORIGIN"
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"key": "X-XSS-Protection",
|
| 58 |
+
"value": "1; mode=block"
|
| 59 |
+
}
|
| 60 |
+
]
|
| 61 |
+
}
|
| 62 |
+
]
|
| 63 |
+
}
|