Skip to content

Commit

Permalink
Fix dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksamies committed Aug 27, 2024
1 parent 217505d commit 0c19c37
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 25 deletions.
8 changes: 1 addition & 7 deletions apps/cyberstorm-remix/app/settings/teams/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function HydrateFallback() {
export default function Teams() {
// REMIX TODO: Move current user to stand-alone loader and revalidate only currentUser
const { currentUser } = useLoaderData<typeof clientLoader>();
const [dialogOpen, setOpenDialog] = useState(false);
const revalidator = useRevalidator();
const [isRefetching, setIsRefetching] = useState(false);

Expand Down Expand Up @@ -73,8 +72,6 @@ export default function Teams() {
description="Manage your teams"
additionalLeftColumnContent={
<Dialog.Root
open={dialogOpen}
onOpenChange={setOpenDialog}
title="Create Team"
trigger={
<Button.Root colorScheme="primary" paddingSize="large">
Expand All @@ -85,10 +82,7 @@ export default function Teams() {
</Button.Root>
}
>
<CreateTeamForm
dialogOnChange={setOpenDialog}
updateTrigger={createTeamRevalidate}
/>
<CreateTeamForm updateTrigger={createTeamRevalidate} />
</Dialog.Root>
}
content={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface Props {
export function ServiceAccountList(props: Props) {
const { serviceAccounts } = props;

const [dialogOpen, setOpenDialog] = useState(false);
const tableData = serviceAccounts.map((serviceAccount, index) => {
return [
{ value: serviceAccount.name, sortValue: serviceAccount.name },
Expand All @@ -29,8 +28,6 @@ export function ServiceAccountList(props: Props) {
{
value: (
<Dialog.Root
open={dialogOpen}
onOpenChange={setOpenDialog}
key={`${serviceAccount.name}_${index}`}
title="Confirm service account removal"
trigger={
Expand All @@ -40,7 +37,6 @@ export function ServiceAccountList(props: Props) {
}
>
<RemoveServiceAccountForm
dialogOnChange={setOpenDialog}
teamName={props.teamName}
serviceAccountNickname={serviceAccount.name}
serviceAccountIdentifier={serviceAccount.identifier}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export function HydrateFallback() {

// REMIX TODO: Make sure user is redirected of this page, if the user is not logged in
export default function Settings() {
const { teamName, currentUser } = useLoaderData<
typeof loader | typeof clientLoader
>();
const { teamName, currentUser } = useLoaderData<typeof clientLoader>();

return (
<div>
Expand Down
6 changes: 1 addition & 5 deletions packages/cyberstorm-forms/src/forms/CreateTeamForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import {
useFormToaster,
} from "@thunderstore/cyberstorm-forms";

export function CreateTeamForm(props: {
dialogOnChange: (v: boolean) => void;
updateTrigger: () => Promise<void>;
}) {
export function CreateTeamForm(props: { updateTrigger: () => Promise<void> }) {
const { onSubmitSuccess, onSubmitError } = useFormToaster({
successMessage: "Team created",
});
Expand All @@ -23,7 +20,6 @@ export function CreateTeamForm(props: {
onSubmitSuccess={() => {
props.updateTrigger();
onSubmitSuccess();
props.dialogOnChange(false);
}}
onSubmitError={onSubmitError}
schema={createTeamFormSchema}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
import { Alert } from "@thunderstore/cyberstorm";

export function RemoveServiceAccountForm(props: {
dialogOnChange: (v: boolean) => void;
serviceAccountIdentifier: string;
serviceAccountNickname: string;
teamName: string;
Expand All @@ -27,7 +26,6 @@ export function RemoveServiceAccountForm(props: {
onSubmitSuccess={() => {
onSubmitSuccess();
props.updateTrigger();
props.dialogOnChange(false);
}}
onSubmitError={onSubmitError}
schema={z.object({})}
Expand Down
4 changes: 0 additions & 4 deletions packages/cyberstorm/src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { Tooltip } from "../..";
import { classnames } from "../../utils/utils";

interface DialogProps extends PropsWithChildren {
open?: boolean;
onOpenChange?: (v: boolean) => void;
trigger?: ReactNode;
title?: string;
showHeaderBorder?: boolean;
Expand All @@ -23,8 +21,6 @@ interface DialogProps extends PropsWithChildren {
export function Dialog(props: DialogProps) {
const {
children,
// open,
// onOpenChange,
trigger,
title = undefined,
showHeaderBorder = false,
Expand Down

0 comments on commit 0c19c37

Please sign in to comment.