From 42302fd53dc8b84a44e2484f0b9810f8eb8c97fc Mon Sep 17 00:00:00 2001 From: Zakher Masri Date: Tue, 11 Mar 2025 16:03:44 +0300 Subject: [PATCH 1/2] chore: ui improvements + add github button --- app/public/logo.svg | 10 ++ app/src/App.tsx | 8 +- app/src/components/Navigation.tsx | 63 ++++++++ app/src/components/TemplateGrid.tsx | 193 +++++++++++++++---------- app/src/components/ui/button.tsx | 2 +- app/src/components/ui/dokploy-logo.tsx | 25 ++++ app/src/index.css | 4 +- app/src/mode-toggle.tsx | 4 +- app/src/store.ts | 25 ++++ app/src/store/index.ts | 29 ++++ 10 files changed, 277 insertions(+), 86 deletions(-) create mode 100644 app/public/logo.svg create mode 100644 app/src/components/Navigation.tsx create mode 100644 app/src/components/ui/dokploy-logo.tsx create mode 100644 app/src/store.ts create mode 100644 app/src/store/index.ts diff --git a/app/public/logo.svg b/app/public/logo.svg new file mode 100644 index 0000000..bd63767 --- /dev/null +++ b/app/public/logo.svg @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/App.tsx b/app/src/App.tsx index af6f47c..a427ed3 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -1,9 +1,13 @@ -import TemplateGrid from './components/TemplateGrid'; -import './App.css'; +import TemplateGrid from "./components/TemplateGrid"; +import Navigation from "./components/Navigation"; +import "./App.css"; function App() { return ( +
+ +
); } diff --git a/app/src/components/Navigation.tsx b/app/src/components/Navigation.tsx new file mode 100644 index 0000000..26c9bc4 --- /dev/null +++ b/app/src/components/Navigation.tsx @@ -0,0 +1,63 @@ +import { ModeToggle } from "@/mode-toggle"; +import { StarIcon } from "lucide-react"; +import { Button } from "./ui/button"; +import { useEffect, useState } from "react"; +import DokployLogo from "./ui/dokploy-logo"; + +const Navigation = () => { + const [githubStars, setGithubStars] = useState(0); + useEffect(() => { + const fetchGithubStars = async () => { + try { + const response = await fetch( + "https://api.github.com/repos/dokploy/dokploy" + ); + const data = await response.json(); + setGithubStars(data.stargazers_count); + } catch (error) { + console.error("Error fetching GitHub stars:", error); + } + }; + + fetchGithubStars(); + }, [setGithubStars]); + + return ( +
+
+ +

Dokploy Templates

+
+
+ + +
+
+ ); +}; + +export default Navigation; diff --git a/app/src/components/TemplateGrid.tsx b/app/src/components/TemplateGrid.tsx index f7c63a4..d44cf0a 100644 --- a/app/src/components/TemplateGrid.tsx +++ b/app/src/components/TemplateGrid.tsx @@ -1,18 +1,26 @@ -import React, { useEffect, useState } from 'react'; -import { Input } from './ui/input'; -import { Card, CardHeader, CardTitle, CardContent, CardFooter } from './ui/card'; +import React, { useEffect, useState } from "react"; +import { Input } from "./ui/input"; +import { + Card, + CardHeader, + CardTitle, + CardContent, + CardFooter, +} from "./ui/card"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, -} from './ui/dialog'; -import { Button } from './ui/button'; -import { toast } from 'sonner'; -import copy from 'copy-to-clipboard'; -import { ModeToggle } from '../mode-toggle'; -import { CodeEditor } from './ui/code-editor'; +} from "./ui/dialog"; +import { Button } from "./ui/button"; +import { toast } from "sonner"; +import copy from "copy-to-clipboard"; +import { ModeToggle } from "../mode-toggle"; +import { CodeEditor } from "./ui/code-editor"; +import { useStore } from "../store"; + interface Template { id: string; name: string; @@ -33,47 +41,53 @@ interface TemplateFiles { } const TemplateGrid: React.FC = () => { - const [templates, setTemplates] = useState([]); + const { templates, setTemplates } = useStore(); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - const [searchQuery, setSearchQuery] = useState(''); - const [selectedTemplate, setSelectedTemplate] = useState