Skip to content

Commit

Permalink
refactor: move all the routes one leve so we can have pages without
Browse files Browse the repository at this point in the history
layout

right now the layout is in the root of the app, so a solution to create
routes without the layout is to move all routes one level deeper

Closes #1010
  • Loading branch information
WilsonNet committed Feb 25, 2025
1 parent 8e39b41 commit 898a956
Show file tree
Hide file tree
Showing 80 changed files with 1,201 additions and 1,097 deletions.
2 changes: 1 addition & 1 deletion dashboard/src/api/hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const useHardwareListing = (
startTimestampInSeconds: number,
endTimestampInSeconds: number,
): UseQueryResult<HardwareListingResponse> => {
const { origin } = useSearch({ from: '/hardware' });
const { origin } = useSearch({ from: '/_main/hardware' });

const queryKey = [
'hardwareListing',
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/api/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const fetchIssueListing = async (
};

export const useIssueListing = (): UseQueryResult<IssueListingResponse> => {
const { origin, intervalInDays } = useSearch({ from: '/issue' });
const { origin, intervalInDays } = useSearch({ from: '/_main/issue' });

const queryKey = ['issueTable', origin, intervalInDays];

Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/api/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useTreeTable = ({
}: {
enabled: boolean;
}): UseQueryResult<Tree[]> => {
const { origin, intervalInDays } = useSearch({ from: '/tree' });
const { origin, intervalInDays } = useSearch({ from: '/_main/tree' });

const queryKey = ['treeTable', origin, intervalInDays];

Expand All @@ -49,7 +49,7 @@ const fetchTreeFastCheckoutData = async (
};

export const useTreeTableFast = (): UseQueryResult<TreeFastPathResponse> => {
const { origin, intervalInDays } = useSearch({ from: '/tree' });
const { origin, intervalInDays } = useSearch({ from: '/_main/tree' });

const queryKey = ['treeTableFast', origin, intervalInDays];

Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/api/treeDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const useTreeSearchParameters = (): TreeSearchParameters => {
const {
origin,
treeInfo: { gitUrl, gitBranch },
} = useSearch({ from: '/tree/$treeId' });
} = useSearch({ from: '/_main/tree/$treeId' });

return { origin, gitUrl, gitBranch };
};
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Cards/CompatibleHardware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CompatibleLink = ({
compatible: string;
diffFilter: TFilter;
}): JSX.Element => {
const { currentPageTab } = useSearch({ from: '/hardware/$hardwareId' });
const { currentPageTab } = useSearch({ from: '/_main/hardware/$hardwareId' });
return (
<FilterLink
filterValue={compatible}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Cards/HardwareUsed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const HardwareLink = ({
hardware: string;
diffFilter: TFilter;
}): JSX.Element => {
const { currentPageTab } = useSearch({ from: '/tree/$treeId' });
const { currentPageTab } = useSearch({ from: '/_main/tree/$treeId' });
return (
<FilterLink
filterValue={hardware}
Expand Down
4 changes: 3 additions & 1 deletion dashboard/src/components/InputTime/InputTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const InputTime = ({
}): JSX.Element => {
const { formatMessage } = useIntl();
const navigate = useNavigate({ from: navigateFrom });
const { intervalInDays: interval } = useSearch({ from: navigateFrom });
const { intervalInDays: interval } = useSearch({
from: `/_main${navigateFrom}`,
});

const InputTimeSchema = z.object({
intervalInDays: z.string().refine(validateStringToNumber, {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/TestDetails/TestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const TestDetailsSections = ({
}): JSX.Element => {
const { formatMessage } = useIntl();
const historyState = useRouterState({ select: s => s.location.state });
const searchParams = useSearch({ from: '/test/$testId' });
const searchParams = useSearch({ from: '/_main/test/$testId' });
const hardware: string = useMemo(() => {
return getTestHardware({
misc: test.environment_misc,
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ const badgeVariants = cva(
destructive:
'border-transparent bg-red-500 text-slate-50 hover:bg-red-500/80 dark:bg-red-900 dark:text-slate-50 dark:hover:bg-red-900/80',
outline: 'text-slate-950 dark:text-slate-50',
blueTag: 'text-dark-blue outline-medium-light-blue border-none bg-light-blue font-medium capitalize outline-1',
greenTag: 'text-dark-green outline-medium-light-green border-none bg-light-green font-medium capitalize outline-1',
blueTag:
'text-dark-blue outline-medium-light-blue border-none bg-light-blue font-medium capitalize outline-1',
greenTag:
'text-dark-green outline-medium-light-green border-none bg-light-green font-medium capitalize outline-1',
},
},
defaultVariants: {
Expand Down
33 changes: 25 additions & 8 deletions dashboard/src/index.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
@import 'tailwindcss';
@import './tailwindcss-animate.css';


@custom-variant dark (&:is(.dark *));

@layer components {
.starburst {
clip-path: polygon(
100% 50%, 78.98% 57.76%, 93.3% 75%, 71.21% 71.21%,
75% 93.3%, 57.76% 78.98%, 50% 100%, 42.24% 78.98%,
25% 93.3%, 28.79% 71.21%, 6.7% 75%, 21.02% 57.76%,
0% 50%, 21.02% 42.24%, 6.7% 25%, 28.79% 28.79%,
25% 6.7%, 42.24% 21.02%, 50% 0%, 57.76% 21.02%,
75% 6.7%, 71.21% 28.79%, 93.3% 25%, 78.98% 42.24%
100% 50%,
78.98% 57.76%,
93.3% 75%,
71.21% 71.21%,
75% 93.3%,
57.76% 78.98%,
50% 100%,
42.24% 78.98%,
25% 93.3%,
28.79% 71.21%,
6.7% 75%,
21.02% 57.76%,
0% 50%,
21.02% 42.24%,
6.7% 25%,
28.79% 28.79%,
25% 6.7%,
42.24% 21.02%,
50% 0%,
57.76% 21.02%,
75% 6.7%,
71.21% 28.79%,
93.3% 25%,
78.98% 42.24%
);
}
}
Expand Down Expand Up @@ -91,7 +108,7 @@
border-color: var(--color-gray-200, currentColor);
}
button:not(:disabled),
[role="button"]:not(:disabled) {
[role='button']:not(:disabled) {
cursor: pointer;
}
}
4 changes: 2 additions & 2 deletions dashboard/src/pages/BuildDetails/BuildDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import TreeBuildDetails from '@/pages/TreeBuildDetails';
import HardwareBuildDetails from '@/pages/HardwareBuildDetails';

const BuildDetailsPage = (): JSX.Element => {
const searchParams = useSearch({ from: '/build/$buildId' });
const { buildId } = useParams({ from: '/build/$buildId' });
const searchParams = useSearch({ from: '/_main/build/$buildId' });
const { buildId } = useParams({ from: '/_main/build/$buildId' });
const navigate = useNavigate({ from: '/build/$buildId' });
const historyState = useRouterState({ select: s => s.location.state });

Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/Hardware/Hardware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DebounceInput from '@/components/DebounceInput/DebounceInput';

const Hardware = (): JSX.Element => {
const { hardwareSearch } = useSearch({
from: '/hardware',
from: '/_main/hardware',
});

const navigate = useNavigate({ from: '/hardware' });
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/Hardware/HardwareListingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const useHardwareListingTime = (): {
startTimestampInSeconds: number;
endTimestampInSeconds: number;
} => {
const { intervalInDays } = useSearch({ from: '/hardware' });
const { intervalInDays } = useSearch({ from: '/_main/hardware' });
const [timestamps, setTimeStamps] = useState(() => {
return calculateTimeStamp(intervalInDays);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { RedirectFrom } from '@/types/general';
import { MemoizedHardwareBreadcrumb } from '@/components/Breadcrumb/HardwareBreadcrumb';

const HardwareBuildDetails = (): JSX.Element => {
const searchParams = useSearch({ from: '/build/$buildId' });
const { buildId } = useParams({ from: '/build/$buildId' });
const searchParams = useSearch({ from: '/_main/build/$buildId' });
const { buildId } = useParams({ from: '/_main/build/$buildId' });
const historyState = useRouterState({ select: s => s.location.state });
const hardwareId = historyState.id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import TestDetails from '@/components/TestDetails/TestDetails';
import { MemoizedHardwareBreadcrumb } from '@/components/Breadcrumb/HardwareBreadcrumb';

const HardwareTestDetails = (): JSX.Element => {
const searchParams = useSearch({ from: '/test/$testId/' });
const { testId } = useParams({ from: '/test/$testId/' });
const searchParams = useSearch({ from: '/_main/test/$testId/' });
const { testId } = useParams({ from: '/_main/test/$testId/' });

return (
<TestDetails
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/IssueDetails/IssueDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const getTestTableRowLink = (testId: string): LinkProps => ({
});

const IssueDetailsPage = (): JSX.Element => {
const searchParams = useSearch({ from: ISSUE_ROUTE });
const { issueId } = useParams({ from: ISSUE_ROUTE });
const searchParams = useSearch({ from: `/_main${ISSUE_ROUTE}` });
const { issueId } = useParams({ from: `/_main${ISSUE_ROUTE}` });
const navigate = useNavigate({ from: ISSUE_ROUTE });
const historyState = useRouterState({ select: s => s.location.state });

Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/TestDetails/TestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HardwareTestDetails from '@/pages/HardwareTestDetails';

const TestDetailsPage = (): JSX.Element => {
const historyState = useRouterState({ select: s => s.location.state });
const { testId } = useParams({ from: '/test/$testId' });
const { testId } = useParams({ from: '/_main/test/$testId' });

if (historyState.id !== undefined) {
if (historyState.from === RedirectFrom.Tree) {
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/TreeBuildDetails/TreeBuildDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { RedirectFrom } from '@/types/general';
import { MemoizedTreeBreadcrumb } from '@/components/Breadcrumb/TreeBreadcrumb';

const TreeBuildDetails = (): JSX.Element => {
const searchParams = useSearch({ from: '/build/$buildId' });
const { buildId } = useParams({ from: '/build/$buildId' });
const searchParams = useSearch({ from: '/_main/build/$buildId' });
const { buildId } = useParams({ from: '/_main/build/$buildId' });
const historyState = useRouterState({ select: s => s.location.state });
const treeId = historyState.id;

Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/TreeDetails/Tabs/Boots/BootsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ interface BootsTabProps {

const BootsTab = ({ treeDetailsLazyLoaded }: BootsTabProps): JSX.Element => {
const { treeId } = useParams({
from: '/tree/$treeId',
from: '/_main/tree/$treeId',
});

const { tableFilter, diffFilter } = useSearch({
from: '/tree/$treeId',
from: '/_main/tree/$treeId',
});

const currentPathFilter = diffFilter.bootPath
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/TreeDetails/Tabs/Build/BuildTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ const BuildTab = ({ treeDetailsLazyLoaded }: BuildTab): JSX.Element => {
});

const { diffFilter } = useSearch({
from: '/tree/$treeId',
from: '/_main/tree/$treeId',
});

const { treeId } = useParams({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/_main/tree/$treeId' });

const summaryData = treeDetailsLazyLoaded.summary?.data?.summary.builds;
const { data: fullData, status: fullStatus } = treeDetailsLazyLoaded.full;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export interface TTreeDetailsBuildsTable {
export function TreeDetailsBuildsTable({
buildItems,
}: TTreeDetailsBuildsTable): JSX.Element {
const { treeId } = useParams({ from: '/tree/$treeId' });
const { tableFilter } = useSearch({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/_main/tree/$treeId' });
const { tableFilter } = useSearch({ from: '/_main/tree/$treeId' });
const navigate = useNavigate({ from: '/tree/$treeId' });

const getRowLink = useCallback(
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/TreeDetails/Tabs/Tests/TestsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ interface TestsTabProps {
}

const TestsTab = ({ treeDetailsLazyLoaded }: TestsTabProps): JSX.Element => {
const { treeId } = useParams({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/_main/tree/$treeId' });

const { full: fullQuery, summary: summaryQuery } = treeDetailsLazyLoaded;
const { data, status, isLoading: fullIsLoading } = fullQuery;
const { isLoading: isSummaryLoading, error: summaryError } = summaryQuery;
const summaryData = treeDetailsLazyLoaded.summary.data?.summary.tests;

const { tableFilter, diffFilter } = useSearch({
from: '/tree/$treeId',
from: '/_main/tree/$treeId',
});

const currentPathFilter = diffFilter.testPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const TreeCommitNavigationGraph = (): React.ReactNode => {
currentPageTab,
diffFilter,
treeInfo: { gitUrl, gitBranch, headCommitHash },
} = useSearch({ from: '/tree/$treeId' });
} = useSearch({ from: '/_main/tree/$treeId' });

const { treeId } = useParams({
from: '/tree/$treeId',
from: '/_main/tree/$treeId',
});

const navigate = useNavigate({
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/TreeDetails/Tabs/TreeDetailsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TreeDetailsTab = ({
treeDetailsLazyLoaded,
}: ITreeDetailsTab): JSX.Element => {
const { currentPageTab } = useSearch({
from: '/tree/$treeId',
from: '/_main/tree/$treeId',
});
const navigate = useNavigate({ from: '/tree/$treeId' });
const treeDetailsTab: ITabItem[] = useMemo(
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/TreeDetails/TreeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ const TreeHeader = ({
function TreeDetails(): JSX.Element {
const { formatMessage } = useIntl();

const { treeId } = useParams({ from: '/tree/$treeId' });
const searchParams = useSearch({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/_main/tree/$treeId' });
const searchParams = useSearch({ from: '/_main/tree/$treeId' });
const { diffFilter, treeInfo } = searchParams;
const navigate = useNavigate({ from: '/tree/$treeId' });

Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/pages/TreeLatest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import { MemoizedSectionError } from '@/components/DetailsPages/SectionError';
import { Skeleton } from '@/components/Skeleton';

export const TreeLatest = (): JSX.Element | void => {
const searchParams = useSearch({ from: '/tree/$treeName/$branch/' });
const searchParams = useSearch({ from: '/_main/tree/$treeName/$branch/' });
const navigate = useNavigate();
const { treeName, branch } = useParams({ from: '/tree/$treeName/$branch/' });
const { treeName, branch } = useParams({
from: '/_main/tree/$treeName/$branch/',
});
const { isLoading, data, error } = useTreeLatest(
treeName,
branch,
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/TreeTestDetails/TreeTestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import TestDetails from '@/components/TestDetails/TestDetails';
import { MemoizedTreeBreadcrumb } from '@/components/Breadcrumb/TreeBreadcrumb';

const TreeTestDetails = (): JSX.Element => {
const searchParams = useSearch({ from: '/test/$testId/' });
const { testId } = useParams({ from: '/test/$testId/' });
const searchParams = useSearch({ from: '/_main/test/$testId/' });
const { testId } = useParams({ from: '/_main/test/$testId/' });

return (
<TestDetails
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/hardwareDetails/HardwareDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ function HardwareDetails(): JSX.Element {
endTimestampInSeconds,
diffFilter,
origin,
} = useSearch({ from: '/hardware/$hardwareId' });
} = useSearch({ from: '/_main/hardware/$hardwareId' });

const { formatMessage } = useIntl();

const { hardwareId } = useParams({ from: '/hardware/$hardwareId' });
const { hardwareId } = useParams({ from: '/_main/hardware/$hardwareId' });

const navigate = useNavigate({ from: '/hardware/$hardwareId' });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const CommitSelector = ({
setTreeIndexesLength: IHardwareHeader['setTreeIndexesLength'];
}): JSX.Element => {
const navigate = useNavigate({ from: '/hardware/$hardwareId/' });
const { treeCommits } = useSearch({ from: '/hardware/$hardwareId' });
const { treeCommits } = useSearch({ from: '/_main/hardware/$hardwareId' });

const navigateToThePast = useCallback(
(commitHash: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const BootsTab = ({
fullDataResult,
}: IBootsTab): JSX.Element => {
const { tableFilter, diffFilter } = useSearch({
from: '/hardware/$hardwareId',
from: '/_main/hardware/$hardwareId',
});

const currentPathFilter = diffFilter.bootPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const BuildTab = ({
});

const { diffFilter } = useSearch({
from: '/hardware/$hardwareId',
from: '/_main/hardware/$hardwareId',
});

const toggleFilterBySection = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function HardwareDetailsBuildsTable({
buildsData,
hardwareId,
}: THardwareDetailsBuildsTable): JSX.Element {
const { tableFilter } = useSearch({ from: '/hardware/$hardwareId' });
const { tableFilter } = useSearch({ from: '/_main/hardware/$hardwareId' });

const navigate = useNavigate({ from: '/hardware/$hardwareId' });

Expand Down
Loading

0 comments on commit 898a956

Please sign in to comment.