Compare commits
2 Commits
379843404f
...
d88fb34881
| Author | SHA1 | Date | |
|---|---|---|---|
| d88fb34881 | |||
| 90897165db |
BIN
public/icons/logo.ico
Normal file
BIN
public/icons/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/icons/logo.png
Normal file
BIN
public/icons/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 269 KiB |
1027
public/icons/logo32.svg
Normal file
1027
public/icons/logo32.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 58 KiB |
211484
public/icons/logoxl-var1.svg
Normal file
211484
public/icons/logoxl-var1.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 13 MiB |
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Hangman Lab</title>
|
<title>Hangman Lab</title>
|
||||||
|
<link rel="icon" type="image/png" href="./icons/logo.png">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
14
src/App.js
14
src/App.js
@@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
|
import {BrowserRouter as Router, Navigate, Route, Routes} from "react-router-dom";
|
||||||
import MainNavigation from "./components/Navigations/MainNavigation";
|
import MainNavigation from "./components/Navigations/MainNavigation";
|
||||||
import SideNavigation from "./components/Navigations/SideNavigation";
|
import SideNavigation from "./components/Navigations/SideNavigation";
|
||||||
import MarkdownContent from "./components/Markdowns/MarkdownContent";
|
import MarkdownContent from "./components/Markdowns/MarkdownContent";
|
||||||
@@ -9,8 +9,11 @@ import Callback from "./components/KeycloakCallbacks/Callback";
|
|||||||
import Footer from "./components/Footer";
|
import Footer from "./components/Footer";
|
||||||
import PopupCallback from "./components/KeycloakCallbacks/PopupCallback";
|
import PopupCallback from "./components/KeycloakCallbacks/PopupCallback";
|
||||||
import SilentCallback from "./components/KeycloakCallbacks/SilentCallback";
|
import SilentCallback from "./components/KeycloakCallbacks/SilentCallback";
|
||||||
|
import {useHomeMarkdown} from "./utils/markdown-queries";
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
|
|
||||||
|
const {home, isLoading, error} = useHomeMarkdown();
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<div className="app-container">
|
<div className="app-container">
|
||||||
@@ -19,7 +22,14 @@ const App = () => {
|
|||||||
<SideNavigation />
|
<SideNavigation />
|
||||||
<main className="main-content">
|
<main className="main-content">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<h1>Welcome to My React Project</h1>} />
|
<Route
|
||||||
|
path="/"
|
||||||
|
element={
|
||||||
|
(home && home.id)
|
||||||
|
? <Navigate to = {`/markdown/${home.id}`}/>
|
||||||
|
: <p>HOME</p>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<Route path="/markdown/:id" element={<MarkdownContent />} />
|
<Route path="/markdown/:id" element={<MarkdownContent />} />
|
||||||
<Route path="/callback" element={<Callback />} />
|
<Route path="/callback" element={<Callback />} />
|
||||||
<Route path="/test" element={<h1>TEST</h1>}></Route>
|
<Route path="/test" element={<h1>TEST</h1>}></Route>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const MainNavigation = () => {
|
|||||||
<nav className="navbar is-dark" role="navigation" aria-label="main navigation">
|
<nav className="navbar is-dark" role="navigation" aria-label="main navigation">
|
||||||
<div className="navbar-brand">
|
<div className="navbar-brand">
|
||||||
<Link className="navbar-item" to="/">
|
<Link className="navbar-item" to="/">
|
||||||
|
<img src="/icons/logo.png" alt="Logo" style={{ height: "40px", marginRight: "10px" }} />
|
||||||
Home
|
Home
|
||||||
</Link>
|
</Link>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -29,6 +29,21 @@ export const useIndexMarkdown = (path_id) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useHomeMarkdown = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const config = useConfig();
|
||||||
|
return useQuery(
|
||||||
|
["home_markdown"],
|
||||||
|
() => fetch_(`${config.BACKEND_HOST}/api/markdown/get_home`), {
|
||||||
|
onSuccess: (data) => {
|
||||||
|
if (data && data.id){
|
||||||
|
queryClient.setQueryData(["markdown", data.id], data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export const useMarkdownsByPath = (pathId) => {
|
export const useMarkdownsByPath = (pathId) => {
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
return useQuery(
|
return useQuery(
|
||||||
|
|||||||
Reference in New Issue
Block a user