Skip to content

Commit

Permalink
Merge pull request #34 from hytech-racing/29-wireguard-deployment
Browse files Browse the repository at this point in the history
prepare for deployment
  • Loading branch information
ryanlau authored Oct 21, 2024
2 parents 4a59ff6 + 4464506 commit 66bf32d
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 34 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://vite.dev/guide/static-deploy.html#github-pages
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 0 additions & 1 deletion src/components/DataCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import "@/css/DataCard.css";

type Props = {
Expand Down
15 changes: 8 additions & 7 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import "@mantine/core/styles.css";
import {} from "@mantine/core";
import "@/css/Navbar.css";
import { NavLink } from "react-router-dom";

const BASE_URL = import.meta.env.BASE_URL;

const mainLinksData = [
{ name: "Files", url: BASE_URL },
{ name: "Documentation", url: `${BASE_URL}docs` },
{ name: "Changelog", url: `${BASE_URL}changelog` },
{ name: "Files", url: "/" },
{ name: "Documentation", url: `/docs` },
{ name: "Changelog", url: `/changelog` },
];

export default function Navbar() {
Expand All @@ -22,7 +19,11 @@ export default function Navbar() {

return (
<nav id="navbar">
{/*<img src="/favicon.ico" alt="Logo" className="navbar-icon" />*/}
<img
src={`${import.meta.env.BASE_URL}favicon.ico`}
alt="Logo"
className="navbar-icon"
/>
{links}
{/* Optionally render active link or other content here */}
<h3 className="hytechName">{hytechName}</h3>
Expand Down
1 change: 0 additions & 1 deletion src/components/PreviewCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useState } from 'react';
import { Text, Button, Grid, Menu, rem, Table, ScrollArea, TextInput } from "@mantine/core";
import { IconDownload, IconChevronDown, IconFile, IconSearch } from "@tabler/icons-react";
Expand Down
6 changes: 4 additions & 2 deletions src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ function SearchBarWithFilter({ setFilteredData }: SearchBarWithFilterProps) {
}, [searchTerm, filters]);

// Handle filter changes
const handleFilterChange = (e) => {
function handleFilterChange(
e: React.ChangeEvent<HTMLSelectElement | HTMLInputElement>,
) {
const { name, value } = e.target;
setFilters((prevFilters) => ({
...prevFilters,
[name]: value,
}));
};
}

return (
<div className="Search">
Expand Down
3 changes: 3 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const router = createBrowserRouter(
<Route path="/changelog" element={<Changelog />} />
</Route>,
),
{
basename: import.meta.env.BASE_URL,
},
);

createRoot(document.getElementById("root")!).render(
Expand Down
13 changes: 0 additions & 13 deletions src/stories/SearchBar.stories.tsx

This file was deleted.

23 changes: 13 additions & 10 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import react from "@vitejs/plugin-react-swc";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
optimizeDeps: {
include: ["@tabler/icons-react"],
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@components": path.resolve(__dirname, "./src/components"),
export default defineConfig(({ mode }) => {
return {
plugins: [react()],
optimizeDeps: {
include: ["@tabler/icons-react"],
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@components": path.resolve(__dirname, "./src/components"),
},
},
base: mode === "production" ? "/query-frontend/" : "",
};
});

0 comments on commit 66bf32d

Please sign in to comment.