Skip to content

Commit

Permalink
tuning compare page
Browse files Browse the repository at this point in the history
  • Loading branch information
berekuk committed Dec 26, 2024
1 parent 4f24c0f commit 2ffceb2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
11 changes: 0 additions & 11 deletions apps/hub/src/app/admin/upgrade-versions/UpgradeVersionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,6 @@ export const UpgradeVersionsPage: FC<{
return (
<div className="container mx-auto">
<H2>Upgrade model versions</H2>
<div>
<p className="text-xs">
Check models with their current version and the new version, then
press the upgrade button if everything is ok.
</p>
<p className="text-xs">
<strong>
{`Code edits won't be saved, "Upgrade" button bumps only the model's version.`}
</strong>
</p>
</div>
<div className="mt-2 text-sm">
<div>Dev models: {devCount}</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ export const UpgradeButton: FC<{
model: ModelFullDTO;
}> = ({ model }) => {
const router = useRouter();

if (
model.currentRevision.contentType === "SquiggleSnippet" &&
model.currentRevision.squiggleSnippet.version === defaultSquiggleVersion
) {
return null;
}

return (
<SafeActionButton
action={adminUpdateModelVersionAction}
Expand Down
34 changes: 25 additions & 9 deletions apps/hub/src/app/admin/upgrade-versions/compare/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { notFound } from "next/navigation";

import { H2 } from "@/components/ui/Headers";
import { StyledLink } from "@/components/ui/StyledLink";
import { modelRoute } from "@/lib/routes";
import { loadModelFull } from "@/models/data/full";
Expand All @@ -26,15 +27,30 @@ export default async function CompareVersionsPage({ searchParams }: Props) {

return (
<div className="bg-white">
<StyledLink
href={modelRoute({
owner: model.owner.slug,
slug: model.slug,
})}
>
{model.owner.slug}/{model.slug}
</StyledLink>
<UpgradeButton model={model} />
<H2>
<div className="flex items-center gap-4">
<div>
Compare model{" "}
<StyledLink
href={modelRoute({ owner: model.owner.slug, slug: model.slug })}
>
{model.owner.slug}/{model.slug}
</StyledLink>
</div>
<UpgradeButton model={model} />
</div>
</H2>
<div>
<p className="text-xs">
Check models with their current version and the new version, then
press the upgrade button if everything is ok.
</p>
<p className="text-xs">
<strong>
{`Code edits won't be saved, "Upgrade" button bumps only the model's version.`}
</strong>
</p>
</div>
<UpgradeableModel model={model} />
</div>
);
Expand Down

0 comments on commit 2ffceb2

Please sign in to comment.