-
Notifications
You must be signed in to change notification settings - Fork 0
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
45 changed files
with
1,498 additions
and
57 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
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,7 @@ | ||
VITE_GITHUB_REPO_OWNER=making-sense-info | ||
VITE_GITHUB_REPO_NAME=addict | ||
VITE_GITHUB_REPO_BRANCH=gh-pages | ||
|
||
VITE_GITHUB_TOKEN= | ||
|
||
VITE_PREFERED_LANGUAGE="fr-FR" |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Making-Sense-Info | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,11 +1,41 @@ | ||
import addictLogo from "/addict.svg"; | ||
|
||
const App = () => ( | ||
<div | ||
style={{ textAlign: "center", display: "flex", justifyContent: "center", alignItems: "center" }} | ||
> | ||
<img src={addictLogo} className="logo" alt="Addict logo" /> | ||
</div> | ||
); | ||
import { ThemeProvider, CssBaseline } from "@mui/material"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { RouterProvider } from "react-router-dom"; | ||
|
||
import { router } from "@pages/router"; | ||
|
||
import { useTheme } from "@store/index"; | ||
|
||
import { lightTheme, darkTheme } from "@theme/index"; | ||
|
||
const queryClient = new QueryClient({ | ||
defaultOptions: { queries: { retry: false, gcTime: 5 * 60 * 1000 } } | ||
}); | ||
|
||
const App = () => { | ||
const { theme } = useTheme(); | ||
|
||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<ThemeProvider theme={theme === "dark" ? darkTheme : lightTheme}> | ||
<CssBaseline /> | ||
<div | ||
style={{ | ||
display: "flex", | ||
flexDirection: "column", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
background: | ||
theme === "dark" | ||
? darkTheme.palette.background.default | ||
: lightTheme.palette.background.default | ||
}} | ||
> | ||
<RouterProvider router={router} /> | ||
</div> | ||
</ThemeProvider> | ||
</QueryClientProvider> | ||
); | ||
}; | ||
|
||
export default App; |
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,12 @@ | ||
import { Outlet } from "react-router-dom"; | ||
|
||
import { TopBar } from "@components/common"; | ||
|
||
const Layout: React.FC = () => ( | ||
<> | ||
<TopBar /> | ||
<Outlet /> | ||
</> | ||
); | ||
|
||
export default Layout; |
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,11 @@ | ||
import { getHeaders } from "@utils/index"; | ||
|
||
export const getContent = (url: string) => | ||
fetch(url, { headers: getHeaders() }) | ||
.then(r => { | ||
if (r.ok) { | ||
return r.json(); | ||
} | ||
throw new Error(`API returns: ${r.status}`); | ||
}) | ||
.then(r => atob(r.content)); |
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,16 @@ | ||
import { getHeaders } from "@utils/index"; | ||
|
||
import { ResourceType } from "@model/index"; | ||
|
||
export const getFiles = (url: string) => | ||
fetch(url, { headers: getHeaders() }) | ||
.then(r => { | ||
if (r.ok) { | ||
return r.json(); | ||
} | ||
throw new Error(`API returns: ${r.status}`); | ||
}) | ||
.then(r => r as ResourceType[]) | ||
.then(r => | ||
r.filter(({ type, name }) => type === "dir" || (type === "file" && name.endsWith(".xml"))) | ||
); |
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,2 @@ | ||
export * from "./file-content"; | ||
export * from "./files"; |
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,46 @@ | ||
import HomeIcon from "@mui/icons-material/Home"; | ||
import { Typography } from "@mui/material"; | ||
import Breadcrumbs from "@mui/material/Breadcrumbs"; | ||
|
||
type GitHubBreadcrumbsProps = { | ||
path: string; | ||
setPath: (p: string) => void; | ||
}; | ||
|
||
function GitHubBreadcrumbs({ path, setPath }: GitHubBreadcrumbsProps) { | ||
const items = path.split("/"); | ||
return ( | ||
<Breadcrumbs aria-label="breadcrumb"> | ||
{items.map((item, index) => ( | ||
<Typography | ||
component={"h6"} | ||
key={index} | ||
onClick={() => setPath(items.slice(0, index + 1).join("/"))} | ||
sx={{ | ||
display: "flex", | ||
alignItems: "center", | ||
textDecoration: "none", | ||
cursor: "pointer", | ||
fontSize: "1.1rem", | ||
marginTop: "0.2em", | ||
marginBottom: "0.2em", | ||
"&:hover": { | ||
textDecoration: "underline" | ||
} | ||
}} | ||
> | ||
{item === "resources" ? ( | ||
<> | ||
<HomeIcon sx={{ mr: 0.5 }} fontSize="inherit" /> | ||
Home | ||
</> | ||
) : ( | ||
item | ||
)} | ||
</Typography> | ||
))} | ||
</Breadcrumbs> | ||
); | ||
} | ||
|
||
export default GitHubBreadcrumbs; |
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,11 @@ | ||
import Typography from "@mui/material/Typography"; | ||
|
||
type ErrorType = { message: string }; | ||
|
||
const Error = ({ message }: ErrorType) => ( | ||
<Typography color="error" variant="body1"> | ||
{message} | ||
</Typography> | ||
); | ||
|
||
export default Error; |
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,5 @@ | ||
import CircularProgress from "@mui/material/CircularProgress"; | ||
|
||
const Loader = () => <CircularProgress sx={{ marginTop: "3em" }} color="secondary" size={100} />; | ||
|
||
export default Loader; |
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,18 @@ | ||
import Brightness4Icon from "@mui/icons-material/Brightness4"; | ||
import Brightness7Icon from "@mui/icons-material/Brightness7"; | ||
import { IconButton } from "@mui/material"; | ||
|
||
type ThemeSwitcherProps = { | ||
isDarkMode: boolean; | ||
toggleTheme: () => void; | ||
}; | ||
|
||
const ThemeSwitcher = ({ isDarkMode, toggleTheme }: ThemeSwitcherProps) => ( | ||
<div style={{ position: "absolute", top: 16, right: 16 }}> | ||
<IconButton onClick={toggleTheme} color="inherit"> | ||
{isDarkMode ? <Brightness7Icon /> : <Brightness4Icon />} | ||
</IconButton> | ||
</div> | ||
); | ||
|
||
export default ThemeSwitcher; |
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,56 @@ | ||
import HomeIcon from "@mui/icons-material/Home"; | ||
import AppBar from "@mui/material/AppBar"; | ||
import Box from "@mui/material/Box"; | ||
import IconButton from "@mui/material/IconButton"; | ||
import Toolbar from "@mui/material/Toolbar"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
import { useTheme } from "@store/index"; | ||
|
||
import ThemeSwitcher from "./ThemeSwitcher"; | ||
import addictLogo from "/addict.svg"; | ||
|
||
function TopBar() { | ||
const navigate = useNavigate(); | ||
const { theme, setTheme } = useTheme(); | ||
|
||
const updateTheme = () => { | ||
setTheme(theme === "dark" ? "light" : "dark"); | ||
}; | ||
|
||
return ( | ||
<AppBar position="static" color="primary"> | ||
<Toolbar> | ||
{/* Home Icon */} | ||
<IconButton | ||
edge="start" | ||
color="inherit" | ||
aria-label="home" | ||
onClick={() => navigate("/")} | ||
sx={{ mr: 2 }} | ||
> | ||
<HomeIcon /> | ||
</IconButton> | ||
|
||
{/* Addict Logo */} | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
flex: 1, | ||
height: "25px" | ||
}} | ||
onClick={() => navigate("/")} | ||
> | ||
<img src={addictLogo} className="logo" alt="Addict logo" /> | ||
</Box> | ||
|
||
{/* Theme Switcher */} | ||
<ThemeSwitcher isDarkMode={theme === "dark"} toggleTheme={updateTheme} /> | ||
</Toolbar> | ||
</AppBar> | ||
); | ||
} | ||
|
||
export default TopBar; |
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,4 @@ | ||
export { default as Breadcrumb } from "./Breadcrumb"; | ||
export { default as Error } from "./Error"; | ||
export { default as Loader } from "./Loader"; | ||
export { default as TopBar } from "./TopBar"; |
Oops, something went wrong.