forked from github-starred/komodo
add recently viewed
This commit is contained in:
@@ -89,9 +89,10 @@ export const useLogin = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const recently_viewed = atomWithStorage<
|
||||
{ type: "Deployment" | "Build" | "Server"; id: string }[]
|
||||
>("recently-viewed", []);
|
||||
const recently_viewed = atomWithStorage<Types.ResourceTarget[]>(
|
||||
"recently-viewed",
|
||||
[]
|
||||
);
|
||||
|
||||
export const useGetRecentlyViewed = () => useAtomValue(recently_viewed);
|
||||
|
||||
|
||||
@@ -8,24 +8,24 @@ import { Settings } from "lucide-react";
|
||||
import { BuildConfig } from "./config";
|
||||
|
||||
export const BuildPage = () => {
|
||||
const { buildId } = useParams();
|
||||
const id = useParams().buildId;
|
||||
const push = useSetRecentlyViewed();
|
||||
|
||||
if (!buildId) return null;
|
||||
push("Build", buildId);
|
||||
if (!id) return null;
|
||||
push("Build", id);
|
||||
|
||||
return (
|
||||
<Resource
|
||||
title={<BuildName id={buildId} />}
|
||||
title={<BuildName id={id} />}
|
||||
info={
|
||||
<div className="text-muted-foreground">
|
||||
<BuildVersion id={buildId} />
|
||||
<BuildVersion id={id} />
|
||||
</div>
|
||||
}
|
||||
actions={
|
||||
<div className="flex gap-4">
|
||||
<RebuildBuild buildId={buildId} />
|
||||
<Link to={`/builds/${buildId}/config`}>
|
||||
<RebuildBuild buildId={id} />
|
||||
<Link to={`/builds/${id}/config`}>
|
||||
<Button variant="outline">
|
||||
<Settings className="w-4 h-4" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ResourceUpdates } from "@components/updates/resource";
|
||||
import { useRead } from "@hooks";
|
||||
import { useRead, useSetRecentlyViewed } from "@hooks";
|
||||
import { ResourceCard } from "@layouts/card";
|
||||
import { Resource } from "@layouts/resource";
|
||||
import {
|
||||
@@ -21,7 +21,10 @@ import { Link, useParams } from "react-router-dom";
|
||||
|
||||
export const DeploymentPage = () => {
|
||||
const id = useParams().deploymentId;
|
||||
const push = useSetRecentlyViewed();
|
||||
|
||||
if (!id) return null;
|
||||
push("Deployment", id);
|
||||
|
||||
return (
|
||||
<Resource
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ResourceUpdates } from "@components/updates/resource";
|
||||
import { useSetRecentlyViewed } from "@hooks";
|
||||
import { Resource } from "@layouts/resource";
|
||||
import { ServerConfig } from "@resources/server/config";
|
||||
import { ServerStatsPage } from "@resources/server/stats";
|
||||
@@ -12,7 +13,10 @@ import { useParams } from "react-router-dom";
|
||||
|
||||
export const ServerPage = () => {
|
||||
const id = useParams().serverId;
|
||||
const push = useSetRecentlyViewed();
|
||||
|
||||
if (!id) return null;
|
||||
push("Server", id);
|
||||
|
||||
return (
|
||||
<Resource
|
||||
|
||||
Reference in New Issue
Block a user