Skip to content

Commit

Permalink
feat(modal): polish create/join modal
Browse files Browse the repository at this point in the history
closes #32
  • Loading branch information
insertish committed Jun 23, 2024
1 parent 45f464e commit 6ffc0f1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
3 changes: 1 addition & 2 deletions packages/client/components/modal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { For } from "solid-js";
import { SetStoreFunction, createStore } from "solid-js/store";

import type { API, Client } from "revolt.js";
import { MFA, MFATicket } from "revolt.js/src/classes/MFA.js";
import type { MFA, MFATicket } from "revolt.js/src/classes/MFA.js";

import { registerController } from "@revolt/common";

Expand Down
16 changes: 7 additions & 9 deletions packages/client/components/modal/modals/CreateOrJoinServer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { BiRegularPlus, BiRegularShare, BiSolidShare } from "solid-icons/bi";

import { useTranslation } from "@revolt/i18n";
import { useNavigate } from "@revolt/routing";
import { styled } from "@revolt/ui";
import { iconSize, styled } from "@revolt/ui";

import MdAdd from "@material-design-icons/svg/outlined/add.svg?component-solid";
import MdLink from "@material-design-icons/svg/outlined/link.svg?component-solid";

import { modalController } from "..";
import { createFormModal } from "../form";
import { PropGenerator } from "../types";

/**
Expand All @@ -15,7 +14,7 @@ const CreateOrJoinServer: PropGenerator<"create_or_join_server"> = (props) => {
const t = useTranslation();

return {
// title: "...",
title: "Create or join a server",
description: (
<Base>
<a
Expand All @@ -27,7 +26,7 @@ const CreateOrJoinServer: PropGenerator<"create_or_join_server"> = (props) => {
});
}}
>
<BiRegularPlus size={48} />
<MdAdd {...iconSize(48)} />
Create
</a>
<a
Expand All @@ -36,12 +35,11 @@ const CreateOrJoinServer: PropGenerator<"create_or_join_server"> = (props) => {
modalController.push({ type: "join_server", client: props.client });
}}
>
<BiRegularShare size={48} />
<MdLink {...iconSize(48)} />
Join
</a>
</Base>
),
actions: [],
};
};

Expand Down
5 changes: 3 additions & 2 deletions packages/client/components/modal/modals/JoinServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ const JoinServer: PropGenerator<"join_server"> = (props) => {

return createFormModal({
modalProps: {
title: "join string",
description: <>link format examples, g90ig, rvlt.gg/t9054t9</>,
title: "Join a server",
description: <>Use a code or invite link</>,
},
schema: {
link: "text",
},
data: {
link: {
field: "code",
placeholder: "rvlt.gg/wVEJDGVs",
},
},
callback: async ({ link }) => {
Expand Down
13 changes: 10 additions & 3 deletions packages/client/components/modal/modals/LeaveServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ const LeaveServer: PropGenerator<"leave_server"> = (props) => {
}),
description: t("app.special.modals.prompt.confirm_leave_long"),
},
schema: {},
data: {},
callback: () => props.server.delete(),
schema: {
silent: "checkbox",
},
data: {
silent: {
title: t("app.special.modals.prompt.silent_leave"),
description: t("app.special.modals.prompt.members_not_notified"),
},
},
callback: (data) => props.server.delete(data.silent),
submit: {
variant: "error",
children: t("app.special.modals.actions.leave"),
Expand Down

0 comments on commit 6ffc0f1

Please sign in to comment.