Skip to content

Commit

Permalink
Added tip button to bottom of page
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed Oct 14, 2023
1 parent f3be2a9 commit c790465
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 23 deletions.
Binary file added client/public/kofi_s_logo_nolabel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 4 additions & 23 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Refine } from "@refinedev/core";
import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";

import { ErrorComponent, ThemedLayoutV2, ThemedSiderV2, ThemedTitleV2 } from "@refinedev/antd";
import { ErrorComponent } from "@refinedev/antd";
import "@refinedev/antd/dist/reset.css";

import routerBindings, {
Expand All @@ -13,19 +13,15 @@ import routerBindings, {
import dataProvider from "./components/dataProvider";
import { useTranslation } from "react-i18next";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";
import { Header } from "./components/header";
import { ColorModeContextProvider } from "./contexts/color-mode";
// @ts-expect-error: svg file
import Logo from "./icon.svg?react";
import { FileOutlined, HighlightOutlined, UserOutlined } from "@ant-design/icons";
import { ConfigProvider } from "antd";
import { Footer } from "antd/es/layout/layout";
import { Version } from "./components/version";
import React from "react";
import { Locale } from "antd/es/locale";
import { languages } from "./i18n";
import loadable from "@loadable/component";
import SpoolmanNotificationProvider from "./components/notificationProvider";
import { SpoolmanLayout } from "./components/layout";

interface PageProps {
resource: "spools" | "filaments" | "vendors";
Expand Down Expand Up @@ -135,24 +131,9 @@ function App() {
<Routes>
<Route
element={
<ThemedLayoutV2
Header={() => <Header sticky />}
Sider={() => (
<ThemedSiderV2
fixed
Title={({ collapsed }) => (
<ThemedTitleV2 collapsed={collapsed} text="Spoolman" icon={<Logo />} />
)}
/>
)}
Footer={() => (
<Footer style={{ textAlign: "center" }}>
Spoolman - {t("version")} <Version />
</Footer>
)}
>
<SpoolmanLayout>
<Outlet />
</ThemedLayoutV2>
</SpoolmanLayout>
}
>
<Route index element={<NavigateToResource resource="spool" />} />
Expand Down
67 changes: 67 additions & 0 deletions client/src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { ThemedLayoutV2, ThemedSiderV2, ThemedTitleV2 } from "@refinedev/antd";
import { Header } from "./header";
import { Footer } from "antd/es/layout/layout";
import { Version } from "./version";
import { Button } from "antd";
// @ts-expect-error: svg file
import Logo from "../icon.svg?react";
import { useTranslate } from "@refinedev/core";

const SpoolmanFooter: React.FC = () => {
const t = useTranslate();

return (
<Footer style={{ textAlign: "center" }}>
<div
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "row",
gap: "2em",
}}
>
<div>
{t("version")} <Version />
</div>
<div>
<Button
icon={
<img
src="./kofi_s_logo_nolabel.png"
style={{
height: "1.6em",
}}
/>
}
type="text"
ghost
href="https://ko-fi.com/donkie"
target="_blank"
>
Tip me on Ko-fi
</Button>
</div>
</div>
</Footer>
);
};

interface SpoolmanLayoutProps {
children: React.ReactNode;
}

export const SpoolmanLayout: React.FC<SpoolmanLayoutProps> = ({ children }) => (
<ThemedLayoutV2
Header={() => <Header sticky />}
Sider={() => (
<ThemedSiderV2
fixed
Title={({ collapsed }) => <ThemedTitleV2 collapsed={collapsed} text="Spoolman" icon={<Logo />} />}
/>
)}
Footer={() => <SpoolmanFooter />}
>
{children}
</ThemedLayoutV2>
);

0 comments on commit c790465

Please sign in to comment.