Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/initial frontend design #20

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5245781
feat(frontend): ✨ add react-icons
Mr0Index Oct 1, 2024
0fea307
package(frontend): 📦 changed eslint rule
Mr0Index Oct 1, 2024
06f8cd3
feat(frontend): ✨ initial frontend sidebar
Mr0Index Oct 1, 2024
1b36951
formatting(frontend): 📝 updated css class names
Mr0Index Oct 2, 2024
b978c3e
formatting(frontend): 📝 changed layout of sidebar folders
Mr0Index Oct 2, 2024
764a78d
feat(frontend): ✨ add devices panel
Mr0Index Oct 3, 2024
14bc367
feat(frontend): ✨ add media-width checking
Mr0Index Oct 5, 2024
082c251
formatting(frontend): 📝 Fixed prettier indenting
Mr0Index Oct 5, 2024
0153e1d
feat(frontend): ✨ add mobilebar
Mr0Index Oct 5, 2024
9f07d62
feat(frontend): ✨ add prettier-tailwindcss plugin setting
Mr0Index Oct 5, 2024
b1b9f40
feat(frontend): ✨ add mobile nav bar
Mr0Index Oct 5, 2024
22ec2ce
feat(frontend): ✨ more work on mobile sidebar
Mr0Index Oct 5, 2024
dacf80b
feat(frontend): ✨ changed font
Mr0Index Oct 5, 2024
f8ebf0f
fix(frontend): 🐛 fixed device card width
Mr0Index Oct 5, 2024
ca26d91
feat(frontend): ✨ add completed device card
Mr0Index Oct 8, 2024
26f81ae
feat(frontend): ✨ add header
Mr0Index Oct 8, 2024
c7fffe1
feat(frontend): ✨ add edit/save button for description box
Mr0Index Oct 9, 2024
cc9dd8c
feat(frontend): ✨ add psudeo working arm feature
Mr0Index Oct 17, 2024
419b186
feat(frontend): ✨ add react routing
Mr0Index Oct 18, 2024
9fa0319
cleanup(frontend): 🔥 changed file structure
Mr0Index Oct 18, 2024
d600228
feat(frontend): ✨ add routing for terminals and logs
Mr0Index Oct 18, 2024
a32eabd
feat(backend): ✨ add dark mode
Mr0Index Oct 22, 2024
f0fdf51
dev(frontend): 🧰 disable generate-react-cli style files
TyIsI Oct 22, 2024
1c57d49
feat(frontend): ✨ add VHS logo/tacos title
Mr0Index Oct 27, 2024
0c7c3a7
feat(frontend): ✨ add navbar highlighting
Mr0Index Nov 3, 2024
a33af19
formatting(frontend): 📝 format
Mr0Index Nov 3, 2024
a56c0be
fix(frontend): 🐛 fixed dark mode toggle
Mr0Index Nov 9, 2024
386b626
feat(frontend): ✨ begun work on homepage
Mr0Index Nov 9, 2024
16eec9c
feat(frontend): ✨ add all devices on dashboard
Mr0Index Nov 10, 2024
59037c2
fix(frontend): 🐛 fixed logo reloading on page switch
Mr0Index Nov 17, 2024
f2232fe
feat(frontend): ✨ started work on terminals page
Mr0Index Nov 21, 2024
c4c3e7d
feat(frontend): ✨ added first pass terminals page
Mr0Index Nov 23, 2024
c29d9a3
fix(frontend): 🐛 fixed save/edit button pushing out of bounds
Mr0Index Nov 23, 2024
63d7c03
fix(frontend): 🐛 fixed save/button for both terminals and devices
Mr0Index Nov 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
{
"files": ["packages/frontend/**/*"],
"options": {
"plugins": ["prettier-plugin-tailwindcss"]
"plugins": ["prettier-plugin-tailwindcss"],
"tailwindPreserveWhitespace": true
}
}
]
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default tseslint.config(
'react-refresh': reactRefresh
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }]
}
Expand Down
28 changes: 14 additions & 14 deletions packages/frontend/generate-react-cli.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"usesTypeScript": true,
"usesStyledComponents": false,
"usesCssModule": true,
"cssPreprocessor": "scss",
"testLibrary": "Testing Library",
"component": {
"default": {
"path": "src/components",
"withStyle": true,
"withTest": true,
"withStory": true,
"withLazy": true
"usesTypeScript": true,
"usesStyledComponents": false,
"usesCssModule": true,
"cssPreprocessor": "scss",
"testLibrary": "Testing Library",
"component": {
"default": {
"path": "src/components",
"withStyle": false,
"withTest": true,
"withStory": true,
"withLazy": true
}
}
}
}
}
4 changes: 2 additions & 2 deletions packages/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>TACOS</title>
</head>
<body>
<div id="root"></div>
<div class="dark" id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"generate-react-cli": "^8.4.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-router-dom": "^6.27.0",
"stylelint": "^16.9.0",
"zod": "^3.23.8"
},
Expand Down
Binary file added packages/frontend/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/frontend/public/react.svg

This file was deleted.

1 change: 0 additions & 1 deletion packages/frontend/public/vite.svg

This file was deleted.

45 changes: 0 additions & 45 deletions packages/frontend/src/components/App/App.css
Original file line number Diff line number Diff line change
@@ -1,45 +0,0 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}

.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}

to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
57 changes: 31 additions & 26 deletions packages/frontend/src/components/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
import { useState } from 'react'
import { useState, useEffect } from 'react'
import { Routes, Route } from 'react-router-dom'
import './App.css'
import MobileBar from '../MobileBar/MobileBar'
import Header from '../Header/Header'
//import SideBarVertical from '../SideBarVertical/SideBarVertical'

import HomePage from '../Pages/HomePage/HomePage'
import DevicesPage from '../Pages/DevicesPage/DevicesPage'
import TerminalsPage from '../Pages/TerminalsPage/TerminalsPage'
import LogsPage from '../Pages/LogsPage/LogsPage'

export function App() {
const [count, setCount] = useState(0)
const [isMobile, setIsMobile] = useState<boolean>(false)

const handleReize = () => {
setIsMobile(window.matchMedia('(max-width: 640px)').matches)
}

useEffect(() => {
handleReize()
window.addEventListener('resize', handleReize)
return () => window.removeEventListener('resize', handleReize)
}, [])

return (
<>
<div className='flex flex-row'>
<div className='basis-1/2'>
<a href='https://vitejs.dev' target='_blank'>
<img src={'/vite.svg'} className='logo m-auto' alt='Vite logo' />
</a>
</div>
<div className='basis-1/2'>
<a href='https://react.dev' target='_blank'>
<img src={'/react.svg'} className='logo m-auto' alt='React logo' />
</a>
</div>
</div>
<h1 className='text-3xl font-bold underline' data-testid='App'>
TACOS
</h1>
<div className='card'>
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className='read-the-docs'>Click on the Vite and React logos to learn more</p>
</>
<div>
<Header />
{isMobile ? <MobileBar /> : <MobileBar />}
<Routes>
<Route path='/' element={<HomePage />} />
<Route path='/devices' element={<DevicesPage />} />
<Route path='/terminals' element={<TerminalsPage />} />
<Route path='/logs' element={<LogsPage />} />
</Routes>
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable */
import DarkModeToggle from './DarkModeToggle';

export default {
title: "DarkModeToggle",
};

export const Default = () => <DarkModeToggle />;

Default.story = {
name: 'default',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { FC, useState, useEffect } from 'react'
import { FaMoon, FaS, FaSun } from 'react-icons/fa6'

const DarkModeToggle: FC = () => {
const DM_KEY = 'dark-mode-key'
const [isDarkMode, setIsDarkMode] = useState(() => {
const savedValue = localStorage.getItem(DM_KEY)
return savedValue ? JSON.parse(savedValue) : true
})

const handleToggle = () => {
setIsDarkMode(!isDarkMode)
if (!isDarkMode) {
document.getElementById('root')?.classList.add('dark')
document.getElementById('root')?.classList.remove('light')
} else {
document.getElementById('root')?.classList.add('light')
document.getElementById('root')?.classList.remove('dark')
}
}

useEffect(() => {
localStorage.setItem(DM_KEY, JSON.stringify(isDarkMode))
}, [isDarkMode])

return (
<div
onClick={handleToggle}
className='bg-card flex h-11 w-20 items-center rounded-full p-1 transition-colors duration-300'
>
<div
className={`flex h-7 w-7 items-center justify-center rounded-full bg-transparent transition-transform duration-300
${isDarkMode ? 'translate-x-[44px]' : 'translate-x-0'}`}
>
{isDarkMode ? <FaMoon className='text-white' size={22} /> : <FaSun size={20} />}
</div>
</div>
)
}

export default DarkModeToggle
12 changes: 12 additions & 0 deletions packages/frontend/src/components/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable */
import Header from './Header';

export default {
title: "Header",
};

export const Default = () => <Header />;

Default.story = {
name: 'default',
};
19 changes: 19 additions & 0 deletions packages/frontend/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { FC } from 'react'
import DarkModeToggle from './DarkModeToggle/DarkModeToggle'
import VHS from './logo.png'

const Header: FC = () => {
return (
<div className='bg-header-body p-2'>
<div className='flex justify-between'>
<div className='flex'>
<img src={VHS} alt='VHS' className='mr-2 h-12 w-28'></img>
<div className='font-teko text-header-text text-6xl font-bold leading-[56px]'>TACOS</div>
</div>
<DarkModeToggle />
</div>
</div>
)
}

export default Header
17 changes: 17 additions & 0 deletions packages/frontend/src/components/Header/Subheader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { FC } from 'react'

interface SubheaderProps {
text: string
}

const Subheader: FC<SubheaderProps> = (props) => {
return (
<div className='bg-header-body p-2'>
<div className='flex justify-between'>
<div className='font-teko text-header-text ml-4 text-5xl font-bold underline'>{props.text}</div>
</div>
</div>
)
}

export default Subheader
Binary file added packages/frontend/src/components/Header/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions packages/frontend/src/components/MobileBar/MobileBar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
.navbar {
@apply bg-navbar-body text-navbar-text fixed bottom-0
left-0 flex w-screen translate-y-0 flex-col
transition-all duration-300;
}

.navbar-collapsed {
@apply translate-y-full;
}

.navbar-button {
@apply bg-navbar-grad-dark flex size-[74px]
flex-col items-center justify-center
rounded-xl bg-gradient-to-tr pt-1 shadow-lg;
}

.navbar-icon {
@apply mb-1;
}

.navbar-icon-text {
@apply font-teko text-lg font-medium;
}
}
12 changes: 12 additions & 0 deletions packages/frontend/src/components/MobileBar/MobileBar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable */
import MobileBar from './MobileBar';

export default {
title: "MobileBar",
};

export const Default = () => <MobileBar />;

Default.story = {
name: 'default',
};
Loading
Loading