Merge pull request #250 from usbharu/delete-web-ui

chore: 不要になったWeb UIのコードを削除
This commit is contained in:
usbharu 2024-01-25 15:29:36 +09:00 committed by GitHub
commit 85d07e31f3
24 changed files with 0 additions and 7828 deletions

View File

@ -1,22 +0,0 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.6.0",
"generators": {
"v3.0": {
"generatorName": "typescript-fetch",
"output": "src/main/web/generated",
"glob": "src/main/resources/openapi/api.yaml",
"additionalProperties": {
"modelPropertyNaming": "camelCase",
"supportsES6": true,
"withInterfaces": true,
"typescriptThreePlus": true,
"useSingleRequestParameter": false,
"prependFormOrBodyParameters": true
}
}
}
}
}

6210
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
{
"name": "hideout",
"version": "1.0.0",
"dependencies": {
"@solid-primitives/context": "^0.2.1",
"@solid-primitives/storage": "^1.3.11",
"@solidjs/router": "^0.8.2",
"@suid/icons-material": "^0.6.3",
"@suid/material": "^0.12.3",
"solid-js": "^1.7.6"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.6.0",
"@suid/vite-plugin": "^0.1.3",
"rollup-plugin-visualizer": "^5.9.2",
"typescript": "^5.0.4",
"vite": "4.2.3",
"vite-plugin-solid": "^2.7.0"
},
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"gen-api": "openapi-generator-cli generate"
}
}

View File

@ -1,22 +0,0 @@
ktor {
development = false
deployment {
port = 8080
port = ${?PORT}
// watch = [classes, resources]
}
application {
modules = [dev.usbharu.hideout.ApplicationKt.parent,dev.usbharu.hideout.ApplicationKt.worker]
}
}
hideout {
url = "http://localhost:8080"
database {
url = "jdbc:h2:./test;MODE=POSTGRESQL"
driver = "org.h2.Driver"
username = ""
password = ""
}
}

View File

@ -1,43 +0,0 @@
ktor {
development = true
deployment {
port = 8080
port = ${?PORT}
watch = [classes, resources]
}
application {
modules = [dev.usbharu.hideout.ApplicationKt.parent,dev.usbharu.hideout.ApplicationKt.worker]
}
}
hideout {
url = "http://localhost:8080"
database {
url = "jdbc:h2:./test;MODE=POSTGRESQL"
driver = "org.h2.Driver"
username = ""
password = ""
}
character-limit {
general {
url = 1000
domain = 255
publicKey = 10000
privateKey = 10000
}
post {
text = 3000
overview = 3000
}
account {
id = 300
name = 300
description = 10000
}
instance {
name = 600
description = 10000
}
}
}

View File

@ -1,519 +0,0 @@
openapi: 3.0.3
info:
title: Hideout API
description: Hideout API
version: 1.0.0
servers:
- url: 'https://test-hideout.usbharu.dev/api/internal/v1'
paths:
/posts:
get:
summary: 権限に応じて投稿一覧を返す
security:
- { }
- BearerAuth: [ ]
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
429:
$ref: "#/components/responses/TooManyRequests"
post:
summary: 投稿する
security:
- BearerAuth: [ ]
requestBody:
description: 投稿する内容
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PostRequest"
responses:
200:
description: 成功
headers:
Location:
description: 作成した投稿のURL
schema:
type: string
format: uri
401:
$ref: "#/components/responses/Unauthorized"
429:
$ref: "#/components/responses/TooManyRequests"
/posts/{postId}:
get:
summary: 権限に応じてIDの投稿を返す
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/postId"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFoundOrForbidden"
429:
$ref: "#/components/responses/TooManyRequests"
/posts/{postId}/reactions:
get:
summary: リアクションを数件返す
security:
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/postId"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/ReactionResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFoundOrForbidden"
429:
$ref: "#/components/responses/TooManyRequests"
post:
summary: リアクションを付ける
security:
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/postId"
requestBody:
description: 付けるリアクション
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Reaction"
responses:
200:
description: 成功
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFoundOrForbidden"
429:
$ref: "#/components/responses/TooManyRequests"
delete:
summary: リアクションを削除する
security:
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/postId"
responses:
200:
description: 成功
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFoundOrForbidden"
429:
$ref: "#/components/responses/TooManyRequests"
/users/{userName}/posts:
get:
summary: 権限に応じてユーザーの投稿一覧を返す
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/userName"
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
429:
$ref: "#/components/responses/TooManyRequests"
/users/{userName}/posts/{postId}:
get:
summary: 権限に応じてIDの投稿を返す
description: userNameが間違っていても取得できます。
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/userName"
- $ref: "#/components/parameters/postId"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFoundOrForbidden"
429:
$ref: "#/components/responses/TooManyRequests"
/users:
get:
summary: ユーザー一覧を返す
security:
- { }
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/UserResponse"
post:
summary: ユーザーを作成する
security:
- { }
requestBody:
description: 作成するユーザーの詳細
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserCreate"
responses:
201:
description: ユーザーが作成された
headers:
Location:
description: 作成されたユーザーのURL
schema:
type: string
format: url
400:
description: ユーザー名が既に仕様されている。またはリクエストが異常
/users/{userName}:
get:
summary: ユーザーの詳細を返す
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/userName"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/UserResponse"
404:
$ref: "#/components/responses/NotFound"
/users/{userName}/followers:
get:
summary: ユーザーのフォロワー一覧を返す
parameters:
- $ref: "#/components/parameters/userName"
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/UserResponse"
post:
summary: ユーザーをフォローする
security:
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/userName"
responses:
200:
description: 成功
202:
description: 受け付けられたが完了していない
401:
$ref: "#/components/responses/Unauthorized"
404:
$ref: "#/components/responses/NotFound"
/users/{userName}/following:
get:
summary: ユーザーのフォロイー一覧を返す
parameters:
- $ref: "#/components/parameters/userName"
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/UserResponse"
/login:
post:
summary: ログインする
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserLogin"
responses:
200:
description: ログイン成功
content:
application/json:
schema:
$ref: "#/components/schemas/JwtToken"
/refresh-token:
post:
summary: 期限切れトークンの再発行をする
responses:
200:
description: トークンの再発行に成功
content:
application/json:
schema:
$ref: "#/components/schemas/JwtToken"
/auth-check:
get:
summary: 認証チェック
responses:
200:
description: 認証に成功
content:
text/plain:
schema:
type: string
components:
responses:
Unauthorized:
description: トークンが無効
Forbidden:
description: 権限がない
NotFoundOrForbidden:
description: 存在しないか権限がない
NotFound:
description: 存在しない
TooManyRequests:
description: レートリミット
parameters:
postId:
name: postId
in: path
description: 投稿ID
required: true
schema:
type: string
userName:
name: userName
in: path
description: ユーザーIDまたはAcctなど @name@domain name@domain name
required: true
schema:
type: string
schemas:
Visibility:
type: string
enum:
- public
- unlisted
- followers
- direct
UserResponse:
type: object
required:
- id
- name
- domain
- screenName
- description
- url
- createdAt
properties:
id:
type: string
readOnly: true
name:
type: string
domain:
type: string
readOnly: true
screenName:
type: string
description:
type: string
nullable: true
url:
type: string
readOnly: true
createdAt:
type: integer
readOnly: true
PostResponse:
type: object
required:
- id
- user
- text
- createdAt
- visibility
- url
- sensitive
properties:
id:
type: string
readOnly: true
user:
$ref: "#/components/schemas/UserResponse"
overview:
type: string
text:
type: string
createdAt:
type: integer
format: int64
readOnly: true
visibility:
$ref: "#/components/schemas/Visibility"
url:
type: string
format: uri
readOnly: true
repostId:
type: string
readOnly: true
replyId:
type: string
readOnly: true
sensitive:
type: boolean
PostRequest:
type: object
properties:
overview:
type: string
text:
type: string
visibility:
$ref: "#/components/schemas/Visibility"
repostId:
type: string
replyId:
type: string
sensitive:
type: boolean
JwtToken:
type: object
properties:
token:
type: string
refreshToken:
type: string
RefreshToken:
type: object
properties:
refreshToken:
type: string
UserLogin:
type: object
properties:
username:
type: string
password:
type: string
Reaction:
type: object
properties:
reaction:
type: string
ReactionResponse:
type: object
properties:
reaction:
type: string
isUnicodeEmoji:
type: boolean
iconUrl:
type: string
accounts:
type: array
items:
$ref: "#/components/schemas/Account"
Account:
type: object
properties:
screenName:
type: string
iconUrl:
type: string
url:
type: string
UserCreate:
type: object
properties:
username:
type: string
password:
type: string
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT

View File

@ -1,572 +0,0 @@
openapi: "3.0.3"
info:
title: "hideout API"
description: "hideout API"
version: "1.0.0"
servers:
- url: "https://hideout"
paths:
/.well-known/jwks.json:
get:
description: ""
responses:
"200":
description: "OK"
content:
application/json:
schema:
type: "string"
/auth-check:
get:
description: ""
responses:
"200":
description: "OK"
content:
text/plain:
schema:
type: "string"
examples:
Example#1:
value: ""
/login:
post:
description: ""
requestBody:
content:
'*/*':
schema:
$ref: "#/components/schemas/UserLogin"
required: true
responses:
"401":
description: "Unauthorized"
content:
'*/*':
schema:
type: "object"
"200":
description: "OK"
content:
'*/*':
schema:
$ref: "#/components/schemas/JwtToken"
/refresh-token:
post:
description: ""
requestBody:
content:
'*/*':
schema:
$ref: "#/components/schemas/RefreshToken"
required: true
responses:
"200":
description: "OK"
content:
'*/*':
schema:
$ref: "#/components/schemas/JwtToken"
/.well-known/webfinger:
get:
description: ""
parameters:
- name: "resource"
in: "query"
required: false
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
$ref: "#/components/schemas/WebFinger"
/api/internal/v1/posts:
get:
description: ""
parameters:
- name: "since"
in: "query"
required: false
schema:
type: "string"
- name: "until"
in: "query"
required: false
schema:
type: "string"
- name: "minId"
in: "query"
required: false
schema:
type: "number"
- name: "maxId"
in: "query"
required: false
schema:
type: "number"
- name: "limit"
in: "query"
required: false
schema:
type: "integer"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "array"
items:
$ref: "#/components/schemas/Post"
post:
description: ""
requestBody:
content:
'*/*':
schema:
$ref: "#/components/schemas/Post"
required: true
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "object"
/api/internal/v1/posts/{id}:
get:
description: ""
parameters:
- name: "id"
in: "path"
required: true
schema:
type: "number"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
$ref: "#/components/schemas/Post"
/api/internal/v1/users:
get:
description: ""
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "array"
items:
$ref: "#/components/schemas/UserResponse"
post:
description: ""
requestBody:
content:
'*/*':
schema:
$ref: "#/components/schemas/UserCreate"
required: true
responses:
"400":
description: "Bad Request"
content:
'*/*':
schema:
type: "object"
"201":
description: "Created"
content:
'*/*':
schema:
type: "object"
/api/internal/v1/users/{name}:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "object"
/api/internal/v1/users/{name}/followers:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "array"
items:
type: "object"
post:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "object"
"202":
description: "Accepted"
content:
'*/*':
schema:
type: "object"
/api/internal/v1/users/{name}/following:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "array"
items:
type: "object"
/api/internal/v1/users/{name}/posts:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "array"
items:
$ref: "#/components/schemas/Post"
/api/internal/v1/users/{name}/posts/{id}:
get:
description: ""
parameters:
- name: "id"
in: "path"
required: true
schema:
type: "number"
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
$ref: "#/components/schemas/Post"
/inbox:
get:
description: ""
responses:
"405":
description: "Method Not Allowed"
content:
'*/*':
schema:
type: "object"
post:
description: ""
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "string"
"501":
description: "Not Implemented"
content:
'*/*':
schema:
type: "object"
/outbox:
get:
description: ""
responses:
"501":
description: "Not Implemented"
content:
'*/*':
schema:
type: "object"
post:
description: ""
responses:
"501":
description: "Not Implemented"
content:
'*/*':
schema:
type: "object"
/users/{name}:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
text/plain:
schema:
type: "string"
/users/{name}/inbox:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"405":
description: "Method Not Allowed"
content:
'*/*':
schema:
type: "object"
post:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"200":
description: "OK"
content:
'*/*':
schema:
type: "string"
"501":
description: "Not Implemented"
content:
'*/*':
schema:
type: "object"
/users/{name}/outbox:
get:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"501":
description: "Not Implemented"
content:
'*/*':
schema:
type: "object"
post:
description: ""
parameters:
- name: "name"
in: "path"
required: true
schema:
type: "string"
responses:
"501":
description: "Not Implemented"
content:
'*/*':
schema:
type: "object"
/:
get:
description: ""
responses:
"200":
description: "OK"
content:
text/html:
schema:
type: "string"
/register:
get:
description: ""
responses:
"200":
description: "OK"
content:
text/html:
schema:
type: "string"
post:
description: ""
parameters:
- name: "password"
in: "query"
required: false
schema:
type: "string"
- name: "username"
in: "query"
required: false
schema:
type: "string"
responses:
"200":
description: "OK <br> Redirect"
content:
text/plain:
schema:
type: "string"
examples:
Example#1:
value: ""
Example#2:
value: "/register"
Example#3:
value: "/register"
Example#4:
value: "/register"
components:
schemas:
UserLogin:
type: "object"
properties:
username:
type: "string"
password:
type: "string"
JwtToken:
type: "object"
properties:
token:
type: "string"
refreshToken:
type: "string"
RefreshToken:
type: "object"
properties:
refreshToken:
type: "string"
Link:
type: "object"
properties:
rel:
type: "string"
type:
type: "string"
href:
type: "string"
WebFinger:
type: "object"
properties:
subject:
type: "string"
links:
type: "array"
items:
$ref: "#/components/schemas/Link"
Post:
type: "object"
properties:
id:
type: "integer"
format: "int64"
userId:
type: "integer"
format: "int64"
overview:
type: "string"
text:
type: "string"
createdAt:
type: "integer"
format: "int64"
visibility:
type: "string"
enum:
- "PUBLIC"
- "UNLISTED"
- "FOLLOWERS"
- "DIRECT"
url:
type: "string"
repostId:
type: "integer"
format: "int64"
replyId:
type: "integer"
format: "int64"
UserResponse:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
domain:
type: "string"
screenName:
type: "string"
description:
type: "string"
url:
type: "string"
createdAt:
type: "integer"
format: "int64"
UserCreate:
type: "object"
properties:
username:
type: "string"
password:
type: "string"

View File

@ -1,44 +0,0 @@
import {Component, createEffect, createSignal} from "solid-js";
import {Route, Router, Routes} from "@solidjs/router";
import {TopPage} from "./pages/TopPage";
import {createTheme, CssBaseline, ThemeProvider, useMediaQuery} from "@suid/material";
import {createCookieStorage} from "@solid-primitives/storage";
import {ApiProvider} from "./lib/ApiProvider";
import {Configuration, DefaultApi} from "./generated";
import {LoginPage} from "./pages/LoginPage";
export const App: Component = () => {
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
const [cookie, setCookie] = createCookieStorage()
const [api, setApi] = createSignal(new DefaultApi(new Configuration({
basePath: window.location.origin + "/api/internal/v1",
accessToken: cookie.token as string
})))
createEffect(() => {
setApi(
new DefaultApi(new Configuration({
basePath: window.location.origin + "/api/internal/v1",
accessToken : cookie.token as string
})))
})
const theme = createTheme({
palette: {
mode: prefersDarkMode() ? 'dark' : 'light',
}
})
return (
<ApiProvider api={api()}>
<ThemeProvider theme={theme}>
<CssBaseline/>
<Router>
<Routes>
<Route path="/" component={TopPage}/>
<Route path="/login" component={LoginPage}/>
</Routes>
</Router>
</ThemeProvider>
</ApiProvider>
)
}

View File

@ -1,8 +0,0 @@
import {Avatar as SuidAvatar} from "@suid/material";
import {Component, JSXElement} from "solid-js";
export const Avatar: Component<{ src: string }> = (props): JSXElement => {
return (
<SuidAvatar src={props.src}/>
)
}

View File

@ -1,14 +0,0 @@
import {ParentComponent} from "solid-js";
import {Button, ListItem, ListItemAvatar, ListItemButton, ListItemIcon, ListItemText} from "@suid/material";
import {Link} from "@solidjs/router";
export const SidebarButton: ParentComponent<{ text: string,linkTo:string }> = (props) => {
return (
<ListItem>
<ListItemButton component={Link} href={props.linkTo}>
<ListItemIcon>{props.children}</ListItemIcon>
<ListItemText primary={props.text}/>
</ListItemButton>
</ListItem>
)
}

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="#000000" name="theme-color"/>
<title>Solid App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="/index.tsx" type="module"></script>
</body>
</html>

View File

@ -1,15 +0,0 @@
/* @refresh reload */
import {render} from 'solid-js/web';
// import './index.css';
import {App} from './App';
const root = document.getElementById('root');
if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
throw new Error(
'Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got mispelled?',
);
}
render(() => <App/>, root!);

View File

@ -1,8 +0,0 @@
import {createContextProvider} from "@solid-primitives/context";
import {createSignal} from "solid-js";
import {DefaultApi, DefaultApiInterface} from "../generated";
export const [ApiProvider,useApi] = createContextProvider((props:{api:DefaultApiInterface}) => {
const [api,setApi] = createSignal(props.api);
return api
},()=>new DefaultApi());

View File

@ -1,16 +0,0 @@
import {DefaultApiInterface} from "../generated";
export class ApiWrapper {
api: DefaultApiInterface;
constructor(initApi: DefaultApiInterface) {
this.api = initApi;
console.log(this.api);
console.log(this.postsGet());
}
postsGet = async () => this.api.postsGet()
usersUserNameGet = async (userName: string) => this.api.usersUserNameGet(userName);
}

View File

@ -1,29 +0,0 @@
import {Component, Match, Switch} from "solid-js";
import {Home, Lock, Mail, Public} from "@suid/icons-material";
import {IconButton} from "@suid/material";
import {Visibility} from "../generated";
export const ShareScopeIndicator: Component<{ visibility: Visibility }> = (props) => {
return <Switch fallback={<Public/>}>
<Match when={props.visibility == "public"}>
<IconButton>
<Public/>
</IconButton>
</Match>
<Match when={props.visibility == "direct"}>
<IconButton>
<Mail/>
</IconButton>
</Match>
<Match when={props.visibility == "followers"}>
<IconButton>
<Lock/>
</IconButton>
</Match>
<Match when={props.visibility == "unlisted"}>
<IconButton>
<Home/>
</IconButton>
</Match>
</Switch>
}

View File

@ -1,53 +0,0 @@
import {Component, createSignal} from "solid-js";
import {Box, Card, CardActions, CardContent, CardHeader, IconButton, Menu, MenuItem, Typography} from "@suid/material";
import {Avatar} from "../atoms/Avatar";
import {Favorite, MoreVert, Reply, ScreenRotationAlt} from "@suid/icons-material";
import {ShareScopeIndicator} from "../molecules/ShareScopeIndicator";
import {PostResponse} from "../generated";
import {useApi} from "../lib/ApiProvider";
export const Post: Component<{ post: PostResponse }> = (props) => {
const api = useApi()
const [anchorEl, setAnchorEl] = createSignal<null | HTMLElement>(null)
const open = () => Boolean(anchorEl());
const handleClose = () => {
setAnchorEl(null);
}
const handleFavorite = () => {
api().postsPostIdReactionsPost({reaction: "❤"}, props.post.id)
}
return (
<Card>
<CardHeader avatar={<Avatar src={props.post.user.url + "/icon.jpg"}/>} title={props.post.user.screenName}
subheader={`${props.post.user.name}@${props.post.user.domain}`}
action={<IconButton onclick={(event) => {
setAnchorEl(event.currentTarget)
}}><MoreVert/><Menu disableScrollLock anchorEl={anchorEl()} open={open()} onClose={handleClose}><MenuItem
onclick={handleClose}>aaa</MenuItem></Menu> </IconButton>}/>
<CardContent>
<Typography>
{props.post.text}
</Typography>
</CardContent>
<CardActions disableSpacing>
<IconButton>
<Reply/>
</IconButton>
<IconButton>
<ScreenRotationAlt/>
</IconButton>
<IconButton onclick={handleFavorite}>
<Favorite/>
</IconButton>
<Box sx={{marginLeft: "auto"}}>
<Typography>{new Date(props.post.createdAt).toDateString()}</Typography>
</Box>
<ShareScopeIndicator visibility={props.post.visibility}/>
</CardActions>
</Card>
)
}

View File

@ -1,43 +0,0 @@
import {Component, createSignal} from "solid-js";
import {Button, IconButton, Paper, Stack, TextField, Typography} from "@suid/material";
import {Avatar} from "../atoms/Avatar";
import {AddPhotoAlternate, Poll, Public} from "@suid/icons-material";
import {useApi} from "../lib/ApiProvider";
export const PostForm: Component<{ label: string }> = (props) => {
const [text, setText] = createSignal("")
const api = useApi()
return (
<Paper sx={{width: "100%"}}>
<Stack>
<Stack direction={"row"} spacing={2} sx={{padding: 2}}>
<Avatar src={""}/>
<TextField label={props.label} multiline rows={4} variant={"standard"} onChange={(event)=>setText(event.target.value)} fullWidth/>
</Stack>
<Stack direction={"row"} justifyContent={"space-between"} sx={{padding: 2}}>
<Stack direction={"row"} justifyContent={"flex-start"} alignItems={"center"}>
<IconButton>
<AddPhotoAlternate/>
</IconButton>
<IconButton>
<Poll/>
</IconButton>
<IconButton>
<Public/>
</IconButton>
</Stack>
<Stack direction={"row"} alignItems={"center"} spacing={2}>
<Typography>
aaa
</Typography>
<Button variant={"contained"} onClick={() => {
api().postsPost({text: text()}).then(()=>setText(""))
}}>
稿
</Button>
</Stack>
</Stack>
</Stack>
</Paper>
)
}

View File

@ -1,58 +0,0 @@
import {Button, Card, CardContent, CardHeader, Modal, Stack, TextField} from "@suid/material";
import {Component, createSignal} from "solid-js";
import {createCookieStorage} from "@solid-primitives/storage";
import {useApi} from "../lib/ApiProvider";
import {useNavigate} from "@solidjs/router";
export const LoginPage: Component = () => {
const [username, setUsername] = createSignal("")
const [password, setPassword] = createSignal("")
const [cookie, setCookie] = createCookieStorage();
const navigator = useNavigate();
const api = useApi();
const onSubmit: () => void = () => {
api().loginPost({password: password(), username: username()}).then(value => {
setCookie("token", value.token);
setCookie("refresh-token", value.refreshToken)
window.location.href = "/"
}).catch(reason => {
console.log(reason);
setPassword("")
})
}
return (
<Modal open>
<Card>
<CardHeader/>
<CardContent>
<Stack spacing={3}>
<TextField
value={username()}
onChange={(event) => setUsername(event.target.value)}
label="Username"
type="text"
autoComplete="username"
variant="standard"
/>
<TextField
value={password()}
onChange={(event) => setPassword(event.target.value)}
label="Password"
type="password"
autoComplete="current-password"
variant="standard"
/>
<Button type={"submit"} onClick={onSubmit}>Login</Button>
</Stack>
</CardContent>
</Card>
</Modal>
)
}

View File

@ -1,24 +0,0 @@
import {Component} from "solid-js";
import {MainPage} from "../templates/MainPage";
import {PostForm} from "../organisms/PostForm";
import {Stack} from "@suid/material";
import {PostResponse} from "../generated";
import {PostList} from "../templates/PostList";
import {useApi} from "../lib/ApiProvider";
import {createStore} from "solid-js/store";
export const TopPage: Component = () => {
const api = useApi()
const [posts, setPosts] = createStore<PostResponse[]>([])
api().postsGet().then((res)=>setPosts(res))
return (
<MainPage>
<Stack spacing={1} alignItems={"stretch"}>
<PostForm label={"投稿する"}/>
<PostList posts={posts}/>
</Stack>
</MainPage>
)
}

View File

@ -1,20 +0,0 @@
import {createSignal, ParentComponent} from "solid-js";
import {Grid} from "@suid/material";
import {Sidebar} from "./Sidebar";
export const MainPage: ParentComponent = (props) => {
return (
<Grid container spacing={2} wrap={"nowrap"}>
<Grid item xs={0} md={3}>
<Sidebar/>
</Grid>
<Grid item xs={12} md={6}>
{props.children}
</Grid>
<Grid item xs={0} md={3}>
</Grid>
</Grid>
)
}

View File

@ -1,14 +0,0 @@
import {Component, For} from "solid-js";
import {CircularProgress} from "@suid/material";
import {Post} from "../organisms/Post";
import {PostResponse} from "../generated";
export const PostList: Component<{ posts: PostResponse[] | undefined }> = (props) => {
return (
<For each={props.posts} fallback={<CircularProgress/>}>
{
(item, index) => <Post post={item}/>
}
</For>
)
}

View File

@ -1,13 +0,0 @@
import {Component} from "solid-js";
import {Button, List, Stack} from "@suid/material";
import {Home} from "@suid/icons-material";
import {SidebarButton} from "../atoms/SidebarButton";
export const Sidebar: Component = (props) => {
return (
<List>
<SidebarButton text={"AP"} linkTo={"/"}></SidebarButton>
<SidebarButton text={"Home"} linkTo={"/"}><Home/></SidebarButton>
</List>
)
}

View File

@ -1,15 +0,0 @@
{
"compilerOptions": {
"strict": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": ["vite/client"],
"noEmit": true,
"isolatedModules": true
}
}

View File

@ -1,24 +0,0 @@
import {defineConfig, splitVendorChunkPlugin} from 'vite';
import solidPlugin from 'vite-plugin-solid';
import suidPlugin from "@suid/vite-plugin";
import visualizer from "rollup-plugin-visualizer";
export default defineConfig({
plugins: [solidPlugin(),suidPlugin(),splitVendorChunkPlugin()],
server: {
port: 3000,
proxy: {
'/api': 'http://localhost:8080',
}
},
root: './src/main/web',
build: {
target: 'esnext',
outDir: '../resources/static',
rollupOptions:{
plugins: [
visualizer()
]
}
},
});