Basic layout

This commit is contained in:
Sugui 2024-02-22 18:26:37 +01:00
parent d64855c950
commit a7a64f0b85
7 changed files with 62 additions and 97 deletions

View File

@ -1,34 +1,35 @@
version: "3"
services:
# mongodb:
# image: mongo:bionic
# container_name: mongodb
# ports:
# - "27017:27017"
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: password
# MONGO_INITDB_DATABASE: bot
# volumes:
# - mongodb_data:/data/db
mongodb:
image: mongo:bionic
container_name: mongodb
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: bot
volumes:
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
- mongodb_data:/data/db
# bot-api:
# image: oven/bun:1
# container_name: bot-api
# command: bun run docker-dev
# working_dir: /usr/src/app
# ports:
# - "8080:8080"
# depends_on:
# - mongodb
# environment:
# MONGODB_URI: "mongodb://mongodb:27017/bot"
# MONGODB_USER: "root"
# MONGODB_PASS: "password"
# JWTSECRET: "cooljwtsecret"
# volumes:
# - ./:/usr/src/app:ro
bot-api:
image: oven/bun:1
container_name: bot-api
command: bun run docker-dev
working_dir: /usr/src/app
ports:
- "8080:8080"
depends_on:
- mongodb
environment:
MONGODB_URI: "mongodb://mongodb:27017/bot"
MONGODB_USER: "root"
MONGODB_PASS: "password"
JWTSECRET: "cooljwtsecret"
volumes:
- ./:/usr/src/app:ro
bot-image-moderation-fe:
image: oven/bun:1

10
init-mongo.js Normal file
View File

@ -0,0 +1,10 @@
db = new Mongo().getDB("bot");
db.createCollection('authorizations');
db.authorization.insert([
{
app: "tester",
secret: "test"
}
])

View File

@ -1,42 +0,0 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}

View File

@ -1,33 +1,10 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import ImageModerator from './components/ImageModerator/ImageModerator'
function App() {
const [count, setCount] = useState(0)
return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
<ImageModerator url='https://picsum.photos/1000'/>
</>
)
}

View File

@ -0,0 +1,8 @@
export interface ButtonProps {
label: string;
action?: () => void;
}
export default function ImageViewer(props: ButtonProps) {
return <button onClick={props.action}>{props.label}</button>
}

View File

@ -0,0 +1,14 @@
import Button from "../Button/Button";
export interface ImageModeratorProps {
url: string;
}
export default function ImageModerator(props: ImageModeratorProps) {
return <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr",
gridTemplateRows: "1fr 50px", gridTemplateAreas: "'. .' '. .'", width: "100vw", height: "100vh" }}>
<img src={props.url} style={{ width: "100%", height: "100%", gridColumnStart: 1, gridColumnEnd: 3, display: "block", objectFit: "contain" }} />
<Button label="Discard" />
<Button label="Accept" />
</div>
}

View File

@ -24,10 +24,7 @@ a:hover {
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {