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

Left Navbar implementation #152

Merged
merged 29 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c13d69b
WIP instance pills
Ynng Jan 8, 2023
2953fbd
Reverted to resizable left nav design
Ynng Jan 9, 2023
3b07fc3
minor
Ynng Jan 9, 2023
352717c
minor
Ynng Jan 9, 2023
23bd775
cargo lock fix
Arcslogger Feb 9, 2023
00c94fb
Merge branch '0.4.2' into new-variable-width-design
Arcslogger Feb 9, 2023
1edf1e9
moved user login and core setting icon to left navbar
NicholasLin718 Feb 10, 2023
7b221f8
fixed truncating of username
NicholasLin718 Feb 11, 2023
21a56d4
new styling for new instance button
NicholasLin718 Feb 11, 2023
10f0590
cleaned up instance select button
NicholasLin718 Feb 11, 2023
b0e3969
add a none intention for button
NicholasLin718 Feb 11, 2023
c935eb1
Moved tabs and instance info to left navbar, added additional routing…
NicholasLin718 Feb 14, 2023
fac0f51
resolved early return error
NicholasLin718 Feb 14, 2023
5f991b4
removed logs
NicholasLin718 Feb 14, 2023
8a4fafc
added keyboard arrow navigation
NicholasLin718 Feb 15, 2023
7ff8199
made left navbar resizable and synced with settings navbar
NicholasLin718 Feb 15, 2023
f2f53e9
styled instance tab titles
NicholasLin718 Feb 16, 2023
b7d5ef5
fixed layout and focus button bugs
NicholasLin718 Feb 16, 2023
cf028b0
overflow clip scroll fix
NicholasLin718 Feb 16, 2023
abd636d
commented out old dashboard route
NicholasLin718 Feb 17, 2023
50a02b7
added path history / load spinner and fixed icon button accessibility
NicholasLin718 Feb 17, 2023
725dbd6
added horizontal margins to prevent overlapping of the navbar
NicholasLin718 Feb 17, 2023
b6e13b8
Merge branch '0.4.2' of https://github.com/Lodestone-Team/dashboard i…
NicholasLin718 Feb 17, 2023
d3b4654
renamed file
NicholasLin718 Feb 17, 2023
deabb61
added dropdown for instance state
NicholasLin718 Feb 17, 2023
fa11ec6
minor styling fix
NicholasLin718 Feb 18, 2023
da48977
select-none on left bar and top bar
NicholasLin718 Feb 18, 2023
05f692d
modified scrollbar + navbar y-padding
NicholasLin718 Feb 18, 2023
5cba268
added consistent dropdown functionality for selected instance state
NicholasLin718 Feb 18, 2023
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
21 changes: 19 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { InstanceViewLayout } from 'components/DashboardLayout/InstanceViewLayou
import { SettingsLayout } from 'components/DashboardLayout/SettingsLayout';
import { toast } from 'react-toastify';
import RequireSetup from 'utils/router/RequireSetup';
import InstanceTabs from 'pages/InstanceTabs/InstanceTabs';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -52,6 +53,15 @@ const queryClient = new QueryClient({
},
});

const InstanceTabList = [
'overview',
'settings',
'console',
'files',
'tasks',
'logs',
];

export default function App() {
const { location, setSearchParam } = useContext(BrowserLocationContext);

Expand Down Expand Up @@ -226,7 +236,7 @@ export default function App() {
>
<Routes>
<Route element={<LoginLayout />}>
<Route path="/first_setup" element={<FirstTime />} />
<Route path="/first_setup" element={<FirstTime />} />
<Route
path="/login/core/select"
element={
Expand Down Expand Up @@ -279,7 +289,14 @@ export default function App() {
}
>
<Route element={<InstanceViewLayout />}>
<Route path="/dashboard" element={<Dashboard />} />
{/* <Route path="/dashboard" element={<Dashboard />} /> */}
{InstanceTabList.map((path, i) => (
<Route
path={`/dashboard/${path}`}
element={<InstanceTabs />}
key={i}
/>
))}
<Route path="/" element={<Home />} />
</Route>
<Route element={<SettingsLayout />}>
Expand Down
8 changes: 6 additions & 2 deletions src/components/Atoms/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ const buttonClasses = cva(
start: 'justify-start',
center: 'justify-center',
end: 'justify-end',
between: 'justify-between',
},
size: {
slim: ['gap-1 rounded-sm p-1 text-small'],
medium: ['gap-1.5 rounded py-1 px-2 text-medium'],
large: ['gap-1.5 rounded py-1.5 px-3 text-h3'],
},
intention: {
none: [],
info: [
'text-gray-300 disabled:text-white/50',
'font-medium',
Expand Down Expand Up @@ -107,11 +109,13 @@ const Button = forwardRef(
>
{iconComponent}
{icon && <FontAwesomeIcon icon={icon} className="w-4 opacity-50" />}
<div className={`flex items-center`}>
<div className={`flex grow items-center truncate`}>
{loading && (
<BeatLoader size={5} color="#6b7280" className="absolute" />
)}
<span className={clsx(loading && 'opacity-0')}>{label}</span>
<span className={clsx(loading && 'opacity-0') + 'truncate'}>
{label}
</span>
</div>

{iconRight && (
Expand Down
85 changes: 85 additions & 0 deletions src/components/Atoms/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { forwardRef } from 'react';
import { cva, VariantProps } from 'class-variance-authority';
import { myTwMerge } from 'utils/util';

const buttonClasses = cva(
[
'group flex',
'select-none flex-row flex-nowrap items-center',
'leading-normal tracking-medium aspect-square',
],
{
variants: {
align: {
start: 'justify-start',
center: 'justify-center',
end: 'justify-end',
},
size: {
slim: [''],
medium: ['gap-2.5 rounded p-1.5 text-medium'],
large: [''],
},
intention: {
default: [
'text-gray-faded/30 enabled:hover:text-white/50 disabled:text-gray-900',
'outline outline-1 rounded',
'bg-gray-800 border-gray-faded/30 enabled:hover:bg-gray-700 enabled:hover:border-gray-faded/50 enabled:active:bg-gray-800 enabled:active:border-gray-faded/50 disabled:border-fade-700/10',
'outline-gray-faded/30 enabled:hover:outline-white/50',
'focus-visible:outline-none enabled:focus-visible:ring-4 enabled:focus-visible:ring-blue-faded/50',
],
},
},
defaultVariants: {
align: 'center',
size: 'medium',
intention: 'default',
},
}
);

export interface IconButtonProps extends VariantProps<typeof buttonClasses> {
disabled?: boolean;
className?: string;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
type?: 'button' | 'submit' | 'reset';
icon?: IconDefinition;
}

// A styled button component
const IconButton = forwardRef(
(
{
disabled = false,
align,
intention,
size,
className,
icon,
type = 'button',
...props
}: IconButtonProps,
ref: React.Ref<HTMLButtonElement>
) => {
return (
<button
className={myTwMerge(
buttonClasses({ align, intention, size }),
className
)}
disabled={disabled}
ref={ref}
type={type}
{...props}
>
{icon && <FontAwesomeIcon icon={icon} className="w-4" />}
</button>
);
}
);

IconButton.displayName = 'IconButton';

export default IconButton;
6 changes: 3 additions & 3 deletions src/components/Atoms/Label.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx';

export type LabelSize = 'small' | 'large';
export type LabelSize = 'small' | 'medium' | 'large';

export type LabelColor = 'green' | 'yellow' | 'red' | 'gray';

Expand All @@ -21,9 +21,9 @@ export default function Label({
return (
<span
className={clsx(
`h-fit select-none whitespace-nowrap rounded-full font-bold tracking-medium`,
{
small: 'py-[0.125em] px-2 text-small font-medium tracking-medium',
medium: 'py-1 px-2 text-small font-medium tracking-medium',
large: 'py-1 px-2 text-medium font-medium tracking-medium',
}[size],
{
Expand All @@ -32,7 +32,7 @@ export default function Label({
red: 'bg-red-faded/25 text-red',
gray: 'bg-gray-faded/30 text-gray-300',
}[color],
className
`h-fit select-none whitespace-nowrap rounded-full font-bold tracking-medium ${className}`
)}
onClick={onClick}
{...rest}
Expand Down
Loading