From 868e54c787b304927a8b84707599eac6401c95cd Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Fri, 16 May 2025 18:19:30 -0600 Subject: [PATCH] Replace all buttons with shadcn buttons --- src/components/FullPlayground.tsx | 223 ++++++++++++---------------- src/components/InlinePlayground.tsx | 19 +-- src/components/ValidationButton.tsx | 6 +- 3 files changed, 106 insertions(+), 142 deletions(-) diff --git a/src/components/FullPlayground.tsx b/src/components/FullPlayground.tsx index 373b247..909919e 100644 --- a/src/components/FullPlayground.tsx +++ b/src/components/FullPlayground.tsx @@ -11,8 +11,7 @@ import { useZedTerminalService } from "../spicedb-common/services/zedterminalser import { parseValidationYAML } from "../spicedb-common/validationfileformat"; import { LinearProgress, Tab, Tabs, Tooltip } from "@material-ui/core"; import AppBar from "@material-ui/core/AppBar"; -import Button from "@material-ui/core/Button"; -import ButtonGroup from "@material-ui/core/ButtonGroup"; +import { Button } from "@/components/ui/button"; import TextField from "@material-ui/core/TextField"; import { Theme, @@ -268,22 +267,6 @@ const useStyles = makeStyles((theme: Theme) => height: "60vh", width: "100%", }, - hideTextOnMed: { - [theme.breakpoints.down("md")]: { - justifyContent: "flex-start", - overflow: "hidden", - width: "28px", - minWidth: "28px", - "& .MuiButton-label": { - justifyContent: "flex-start", - overflow: "hidden", - width: "28px", - "& .MuiButton-startIcon.MuiButton-iconSizeSmall": { - marginLeft: "0px", - }, - }, - }, - }, hide: { display: "none", }, @@ -295,18 +278,6 @@ const useStyles = makeStyles((theme: Theme) => gridTemplateColumns: "1fr auto", alignItems: "center", }, - btnAccept: { - "& .MuiSvgIcon-root": { - fill: theme.palette.success.main, - }, - color: theme.palette.getContrastText(theme.palette.success.main), - }, - btnRevert: { - "& .MuiSvgIcon-root": { - fill: theme.palette.error.main, - }, - color: theme.palette.getContrastText(theme.palette.error.main), - }, tenantGraphContainer: { width: "100%", height: "100%", @@ -759,59 +730,59 @@ export function ThemedAppView(props: { datastore: DataStore }) { )} {AppConfig().discord.inviteUrl ? ( - ) : ( )} + {isSharingEnabled && ( + + )} - )} @@ -888,11 +859,8 @@ export function ThemedAppView(props: { datastore: DataStore }) {
{currentItem?.kind === DataStoreItemKind.SCHEMA && ( - )} @@ -925,115 +893,110 @@ export function ThemedAppView(props: { datastore: DataStore }) {
)} - {currentItem?.kind === DataStoreItemKind.ASSERTIONS && ( - - )} - - {currentItem?.kind === DataStoreItemKind.EXPECTED_RELATIONS && ( - - )} + {currentItem?.kind !== undefined && + [ + DataStoreItemKind.ASSERTIONS, + DataStoreItemKind.EXPECTED_RELATIONS, + ].includes(currentItem.kind) && ( + + )} {currentItem?.kind === DataStoreItemKind.EXPECTED_RELATIONS && previousValidationForDiff === undefined && ( - + <> - + )} {currentItem?.kind === DataStoreItemKind.EXPECTED_RELATIONS && previousValidationForDiff !== undefined && ( - - - - + )}
{currentItem?.kind === DataStoreItemKind.SCHEMA && ( - )} {currentItem?.kind === DataStoreItemKind.RELATIONSHIPS && ( - )} {currentItem?.kind === DataStoreItemKind.ASSERTIONS && ( - )} {currentItem?.kind === DataStoreItemKind.EXPECTED_RELATIONS && ( - )}
diff --git a/src/components/InlinePlayground.tsx b/src/components/InlinePlayground.tsx index 35a9b7b..d0cf448 100644 --- a/src/components/InlinePlayground.tsx +++ b/src/components/InlinePlayground.tsx @@ -4,7 +4,7 @@ import { parseSchema } from "../spicedb-common/parsers/dsl/dsl"; import { parseRelationships } from "../spicedb-common/parsing"; import { useDeveloperService } from "../spicedb-common/services/developerservice"; import AppBar from "@material-ui/core/AppBar"; -import Button from "@material-ui/core/Button"; +import { Button } from "@/components/ui/button"; import { createStyles, darken, @@ -193,14 +193,15 @@ function InlinePlaygroundUI(props: { datastore: DataStore }) { />
-
diff --git a/src/components/ValidationButton.tsx b/src/components/ValidationButton.tsx index 76c7661..e5e794f 100644 --- a/src/components/ValidationButton.tsx +++ b/src/components/ValidationButton.tsx @@ -1,5 +1,5 @@ import { DeveloperService } from "../spicedb-common/services/developerservice"; -import Button from "@material-ui/core/Button"; +import { Button } from "@/components/ui/button"; import { Theme, createStyles, makeStyles } from "@material-ui/core/styles"; import { fade } from "@material-ui/core/styles/colorManipulator"; import CheckCircleIcon from "@material-ui/icons/CheckCircle"; @@ -96,8 +96,7 @@ export function ValidateButton(props: { "Validation not run"}