some stuff
This commit is contained in:
@@ -6,11 +6,15 @@
|
||||
"@types/jest": "27.4.0",
|
||||
"@types/node": "17.0.13",
|
||||
"solid-js": "^1.3.4",
|
||||
"solid-scripts": "0.0.61",
|
||||
"typescript": "4.5.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"solid-app-router": "^0.2.1"
|
||||
"@fortawesome/fontawesome-free": "^5.15.4",
|
||||
"axios": "^0.25.0",
|
||||
"bulma": "^0.9.3",
|
||||
"sass": "^1.49.0",
|
||||
"solid-app-router": "^0.2.1",
|
||||
"solid-scripts": "^0.0.61"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "solid-scripts start",
|
||||
|
||||
2605
assets/pnpm-lock.yaml
generated
2605
assets/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
@@ -11,6 +12,7 @@
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<script src="https://kit.fontawesome.com/a6eecf466d.js" crossorigin="anonymous"></script>
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { lazy } from "solid-js";
|
||||
import { Routes, Route, Link } from "solid-app-router";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div>
|
||||
<h2>App</h2>
|
||||
<p>Some other stuff</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App;
|
||||
17
assets/src/app.tsx
Normal file
17
assets/src/app.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { Component } from "solid-js";
|
||||
import { useRoutes, useLocation } from "solid-app-router";
|
||||
|
||||
import { routes } from "./routes"
|
||||
|
||||
const App: Component = () => {
|
||||
const location = useLocation();
|
||||
const Route = useRoutes(routes);
|
||||
document.title += location.pathname
|
||||
return (
|
||||
<div>
|
||||
<Route />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App;
|
||||
18
assets/src/componets/auth/auth.ts
Normal file
18
assets/src/componets/auth/auth.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import axios from "axios";
|
||||
|
||||
const API_URL = "/api/auth"
|
||||
|
||||
const register = async (username: string, email: string, password: string) => {
|
||||
axios.post(API_URL + "/register", {
|
||||
username,
|
||||
email,
|
||||
password
|
||||
}).then(
|
||||
responce => {
|
||||
if (responce.data.username) {
|
||||
|
||||
}
|
||||
return responce
|
||||
}
|
||||
);
|
||||
}
|
||||
0
assets/src/componets/auth/login.tsx
Normal file
0
assets/src/componets/auth/login.tsx
Normal file
0
assets/src/componets/auth/register.tsx
Normal file
0
assets/src/componets/auth/register.tsx
Normal file
23
assets/src/componets/burger.tsx
Normal file
23
assets/src/componets/burger.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Component, ComponentProps, JSX } from 'solid-js';
|
||||
|
||||
interface burgerProps extends ComponentProps<'span'> {
|
||||
datatarget: string
|
||||
}
|
||||
|
||||
const handelClick: JSX.EventHandler<HTMLSpanElement, MouseEvent> = (e) => {
|
||||
var menu = document.querySelector("#" + e.currentTarget.dataset.target);
|
||||
e.currentTarget.classList.toggle("is-active");
|
||||
menu?.classList.toggle("is-active");
|
||||
}
|
||||
|
||||
const Burger: Component<burgerProps> = (props: burgerProps) => {
|
||||
return (
|
||||
<span onClick={handelClick} class="navbar-burger burger" data-target={props.datatarget} >
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
export default Burger;
|
||||
54
assets/src/componets/navbar.tsx
Normal file
54
assets/src/componets/navbar.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Component } from 'solid-js';
|
||||
import { Link } from "solid-app-router";
|
||||
import Burger from './burger';
|
||||
|
||||
const Navbar: Component = () => {
|
||||
return (
|
||||
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="/">
|
||||
<h1 class="is-size-2">WOK ABLE</h1>
|
||||
</a>
|
||||
<Burger datatarget='navbarMenu' />
|
||||
</div>
|
||||
<div id="navbarMenu" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<Link class="navbar-item" href="/">
|
||||
<span class="icon">
|
||||
<i class="fa fa-home"></i>
|
||||
</span>
|
||||
<span>Home</span>
|
||||
</Link>
|
||||
<a class="navbar-item" href='https://spahl.ddns.net/jasper'>
|
||||
<span class="icon">
|
||||
<i class="fa-brands fa-git-alt"></i>
|
||||
</span>
|
||||
<span>View Source</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<span class="navbar-item">
|
||||
<Link class="button is-dark" href="/register">
|
||||
<span class="icon">
|
||||
<i class="fa fa-user-plus"></i>
|
||||
</span>
|
||||
<span>Register</span>
|
||||
</Link>
|
||||
</span>
|
||||
<span class="navbar-item">
|
||||
<Link class="button is-info" href="/login">
|
||||
<span class="icon">
|
||||
<i class="fa fa-arrow-right-to-bracket"></i>
|
||||
</span>
|
||||
<span>Login</span>
|
||||
</Link>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
|
||||
export default Navbar;
|
||||
@@ -1,13 +0,0 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||
monospace;
|
||||
}
|
||||
10
assets/src/index.scss
Normal file
10
assets/src/index.scss
Normal file
@@ -0,0 +1,10 @@
|
||||
@charset "utf-8";
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@import "../node_modules/bulma/bulma.sass";
|
||||
|
||||
$schema-main: $white;
|
||||
$schema-inverted: $black;
|
||||
@@ -1,15 +1,16 @@
|
||||
import "solid-js";
|
||||
import { render } from 'solid-js/web';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
import { Router } from "solid-app-router";
|
||||
import App from './app';
|
||||
|
||||
import "./index.scss"
|
||||
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
|
||||
render(() => (
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
|
||||
),
|
||||
document.getElementById('root') as Node);
|
||||
|
||||
|
||||
16
assets/src/pages/home.module.scss
Normal file
16
assets/src/pages/home.module.scss
Normal file
@@ -0,0 +1,16 @@
|
||||
.coolbg {
|
||||
background: linear-gradient(
|
||||
rgba(0, 0, 0, 0.5),
|
||||
rgba(0, 0, 0, 0.5)
|
||||
), url('https://unsplash.it/1200/900?random') no-repeat center center fixed;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
.isomatrix {
|
||||
position: relative;
|
||||
transform-style: preserve-3d;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
transform: rotate(-30deg) skew(30deg)
|
||||
}
|
||||
8
assets/src/pages/home.scss
Normal file
8
assets/src/pages/home.scss
Normal file
@@ -0,0 +1,8 @@
|
||||
.hero .nav, .hero.is-success .nav {
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.hero .subtitle {
|
||||
padding: 3rem 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
29
assets/src/pages/home.tsx
Normal file
29
assets/src/pages/home.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Link } from 'solid-app-router';
|
||||
import { Component } from 'solid-js';
|
||||
import Navbar from "../componets/navbar";
|
||||
import styles from "./home.module.scss";
|
||||
import "./home.scss";
|
||||
|
||||
const Home: Component = () => {
|
||||
return (
|
||||
<>
|
||||
<section class={`hero is-info ${styles.coolbg}`}>
|
||||
<div class={`hero-body`}>
|
||||
<div class="container has-text-centered">
|
||||
<div class="column is-6 is-offset-3">
|
||||
<h1 class="title">
|
||||
Wok Able
|
||||
</h1>
|
||||
<h2 class="subtitle">
|
||||
The easy to use vacabulary learing system
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<Navbar />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Home;
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Component, ComponentProps } from 'solid-js';
|
||||
|
||||
interface indexProps extends ComponentProps<any> {
|
||||
// add props here
|
||||
}
|
||||
|
||||
const index: Component<indexProps> = (props: indexProps) => {
|
||||
return (
|
||||
<div>
|
||||
<h2>index</h2>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default index;
|
||||
11
assets/src/routes.ts
Normal file
11
assets/src/routes.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { lazy } from "solid-js";
|
||||
import type { RouteDefinition } from "solid-app-router";
|
||||
|
||||
import Home from "./pages/home"
|
||||
|
||||
export const routes: RouteDefinition[] = [
|
||||
{
|
||||
path: "/",
|
||||
component: Home
|
||||
}
|
||||
]
|
||||
9
assets/src/utils.ts
Normal file
9
assets/src/utils.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { createEffect } from "solid-js";
|
||||
import { Store, SetStoreFunction, createStore } from "solid-js/store"
|
||||
|
||||
export function createLocalStore<T>(initState: T, name: string): [Store<T>, SetStoreFunction<T>] {
|
||||
const [state, setState] = createStore(initState);
|
||||
if (localStorage[name]) setState(JSON.parse(localStorage[name]))
|
||||
createEffect(() => (localStorage[name] = JSON.stringify(state)))
|
||||
return [state, setState]
|
||||
}
|
||||
@@ -25,7 +25,7 @@ func Register(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
c.SetCookie("token", token, 2*60*60, "", "", false, true)
|
||||
c.Status(http.StatusCreated)
|
||||
c.JSON(http.StatusCreated, gin.H{"username": user.Username, "email": user.Email})
|
||||
}
|
||||
|
||||
func Login(c *gin.Context) {
|
||||
@@ -48,7 +48,7 @@ func Login(c *gin.Context) {
|
||||
|
||||
token, _ := auth.GenerateJWT(user.ID, user.Username, user.Email)
|
||||
c.SetCookie("token", token, 2*60*60, "", "", false, true)
|
||||
c.Status(http.StatusOK)
|
||||
c.JSON(http.StatusOK, gin.H{"username": user.Username, "email": user.Email})
|
||||
}
|
||||
|
||||
func Logout(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user