diff --git a/src/components/manage/change-warning.tsx b/src/components/manage/change-warning.tsx new file mode 100644 index 0000000..2cfd1cd --- /dev/null +++ b/src/components/manage/change-warning.tsx @@ -0,0 +1,25 @@ +import clsx from "clsx"; + +/** A caution line under a repository's change preview; renders nothing without a warning. */ +export function ChangeWarning({ + className, + warning, +}: Readonly<{ + className?: string; + warning: string | null; +}>) { + if (warning === null) { + return null; + } + + return ( +

+ {warning} +

+ ); +} diff --git a/src/components/manage/manage-edit-dialog.tsx b/src/components/manage/manage-edit-dialog.tsx index 21966ce..030a8e8 100644 --- a/src/components/manage/manage-edit-dialog.tsx +++ b/src/components/manage/manage-edit-dialog.tsx @@ -15,11 +15,13 @@ import { Field, Fieldset, Label } from "@/components/ui/fieldset"; import { Strong, Text } from "@/components/ui/text"; import { formatRepositoryCount } from "@/format"; import type { GitHubRepository, ManageRepositoryActions } from "@/github/types"; +import { ChangeWarning } from "./change-warning"; import { MANAGE_ARCHIVE_ACTION_OPTIONS, MANAGE_SUBSCRIPTION_ACTION_OPTIONS, } from "./types"; import { + getArchivedVisibilityWarning, getManageActionsSummary, getManageVisibilityActionOptions, getRepositoryChangeLines, @@ -160,6 +162,9 @@ function RepositoryChangePreview({ ) : ( No change needed. )} + ); } diff --git a/src/components/manage/manage-review-dialog.tsx b/src/components/manage/manage-review-dialog.tsx index 3762e44..77ebe1c 100644 --- a/src/components/manage/manage-review-dialog.tsx +++ b/src/components/manage/manage-review-dialog.tsx @@ -15,7 +15,12 @@ import { import { Strong, Text } from "@/components/ui/text"; import { formatRepositoryCount } from "@/format"; import type { GitHubRepository, ManageRepositoryActions } from "@/github/types"; -import { getRepositoryChangeLines, type StagedChanges } from "./utils"; +import { ChangeWarning } from "./change-warning"; +import { + getArchivedVisibilityWarning, + getRepositoryChangeLines, + type StagedChanges, +} from "./utils"; /** Lists every staged change so the whole batch is confirmed at once. */ export function ManageReviewDialog({ @@ -105,6 +110,9 @@ function StagedChangeItem({ const changeLines = actions ? getRepositoryChangeLines(repository, actions) : []; + const warning = actions + ? getArchivedVisibilityWarning(repository, actions) + : null; return (
  • @@ -115,6 +123,7 @@ function StagedChangeItem({ {changeLine} ))} +