-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
206 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
VITE_BASEURL="127.0.0.1:8080" | ||
VITE_BASEURL="localhost:8080" | ||
VITE_PROTOCOL="http://" | ||
VITE_APIPATH="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,53 @@ | ||
import { Navigate, useNavigate } from "solid-app-router"; | ||
import { Component, createMemo, createResource, createSignal, For, Show } from "solid-js"; | ||
import { Navigate } from "solid-app-router"; | ||
import { Component, createResource, Show } from "solid-js"; | ||
import { useService } from "solid-services"; | ||
import Layout from "./Layout"; | ||
import { AuthService } from "./store/AuthService"; | ||
import { IToken } from "./types/user.interface"; | ||
|
||
const Dashboard: Component = () => { | ||
|
||
const authService = useService(AuthService); | ||
const [tokens] = createResource(() => { | ||
return authService().client.common.tokens(); | ||
}); | ||
|
||
const [selectedToken, setSelectedToken] = createSignal<IToken>(); | ||
const navigate = useNavigate(); | ||
|
||
|
||
// createMemo(() => { | ||
// if (!authService().isLoggedIn) { | ||
// navigate('/login', { replace: true, state: { redirectTo: '/dashboard' } }); | ||
// } | ||
// }); | ||
|
||
return ( | ||
<> | ||
<Show when={authService().user === null}> | ||
<Navigate href="/login" state={{ redirectTo: '/dashboard' }} /> | ||
</Show> | ||
<Layout> | ||
<div class="rounded-lg shadow bg-base-200 drawer drawer-mobile h-52"> | ||
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" /> | ||
<div class="flex flex-col items-center justify-center drawer-content"> | ||
<label for="my-drawer-2" class="mb-4 btn btn-primary drawer-button lg:hidden">open menu</label> | ||
<div class="text-xs text-center"> | ||
<Show when={selectedToken()} fallback="Please select a token"> | ||
{selectedToken().token} | ||
</Show> | ||
</div> | ||
</div> | ||
<div class="drawer-side"> | ||
<label for="my-drawer-2" class="drawer-overlay"></label> | ||
<ul class="menu p-4 overflow-y-auto w-80 bg-base-100 text-base-content"> | ||
<For each={tokens()}> | ||
{(token) => ( | ||
<li> | ||
<a | ||
classList={{ active: token.token === selectedToken()?.token }} | ||
onclick={(_e) => setSelectedToken(token)} | ||
> | ||
{token.name} | ||
</a> | ||
</li> | ||
)} | ||
</For> | ||
|
||
</ul> | ||
</div> | ||
const authService = useService(AuthService); | ||
const [options, { refetch }] = createResource(() => { | ||
return authService().client.common.options(); | ||
}); | ||
|
||
const reset = () => | ||
authService().client.common.reset() | ||
.then(refetch); | ||
|
||
return ( | ||
<> | ||
<Show when={authService().user === null}> | ||
<Navigate href="/login" state={{ redirectTo: '/dashboard' }} /> | ||
</Show> | ||
<Layout> | ||
<div class="rounded-lg shadow bg-base-200 drawer drawer-mobile h-52"> | ||
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" /> | ||
<div class="flex flex-col items-center justify-center drawer-content"> | ||
<label for="my-drawer-2" class="mb-4 btn btn-primary drawer-button lg:hidden">open menu</label> | ||
<div class="text-xs text-center"> | ||
<div class="form-control"> | ||
<div class="relative"> | ||
<input class="input input-bordered w-[50ex]" type="text" readonly value={options()?.token || 'Create Token'} /> | ||
<button onclick={reset} class="absolute top-0 right-0 rounded-l-none btn btn-primary">{options() ? 'reset' : 'create'}</button> | ||
</div> | ||
</Layout> | ||
</> | ||
); | ||
</div> | ||
</div> | ||
</div> | ||
<div class="drawer-side"> | ||
<label for="my-drawer-2" class="drawer-overlay"></label> | ||
<ul class="menu p-4 overflow-y-auto w-80 bg-base-100 text-base-content"> | ||
<li> | ||
<a classList={{ active: true }}> | ||
Stream Token | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</Layout> | ||
</> | ||
); | ||
} | ||
|
||
export default Dashboard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ const Stream: Component = () => { | |
); | ||
}; | ||
|
||
export default Stream; | ||
export default Stream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table tokens rename to options; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table users add column hidden boolean not null default false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table options add unique (user_id); |
Oops, something went wrong.