diff --git a/src/context/intermediate/Intermediate.tsx b/src/context/intermediate/Intermediate.tsx index e6a3eb49..a2e5b1ec 100644 --- a/src/context/intermediate/Intermediate.tsx +++ b/src/context/intermediate/Intermediate.tsx @@ -24,6 +24,7 @@ export type Screen = | { id: "signed_out" } | { id: "error"; error: string } | { id: "clipboard"; text: string } + | { id: "token_reveal"; token: string; username: string } | { id: "external_link_prompt"; link: string } | { id: "_prompt"; diff --git a/src/context/intermediate/Modals.tsx b/src/context/intermediate/Modals.tsx index 8815a16d..f8b57109 100644 --- a/src/context/intermediate/Modals.tsx +++ b/src/context/intermediate/Modals.tsx @@ -10,6 +10,7 @@ import { OnboardingModal } from "./modals/Onboarding"; import { PromptModal } from "./modals/Prompt"; import { SignedOutModal } from "./modals/SignedOut"; import {ExternalLinkModal} from "./modals/ExternalLinkPrompt"; +import { TokenRevealModal } from "./modals/TokenReveal"; export interface Props { screen: Screen; @@ -33,6 +34,8 @@ export default function Modals({ screen, openScreen }: Props) { return ; case "clipboard": return ; + case "token_reveal": + return ; case "onboarding": return ; case "external_link_prompt": diff --git a/src/context/intermediate/modals/TokenReveal.tsx b/src/context/intermediate/modals/TokenReveal.tsx new file mode 100644 index 00000000..5fa8a288 --- /dev/null +++ b/src/context/intermediate/modals/TokenReveal.tsx @@ -0,0 +1,27 @@ +import { Text } from "preact-i18n"; + +import Modal from "../../../components/ui/Modal"; + +interface Props { + onClose: () => void; + token: string; + username: string; +} + +export function TokenRevealModal({ onClose, token,username }: Props) { + return ( + , + }, + ]}> + {token} + + ); +} diff --git a/src/pages/settings/panes/MyBots.tsx b/src/pages/settings/panes/MyBots.tsx index 5e558954..27e21083 100644 --- a/src/pages/settings/panes/MyBots.tsx +++ b/src/pages/settings/panes/MyBots.tsx @@ -1,17 +1,26 @@ +import { Key, Clipboard, Globe } from "@styled-icons/boxicons-regular"; +import { LockAlt } from "@styled-icons/boxicons-solid"; import { observer } from "mobx-react-lite"; import { Bot } from "revolt-api/types/Bots"; +import styled from "styled-components"; +import styles from "./Panes.module.scss"; +import { Text } from "preact-i18n"; import { useEffect, useState } from "preact/hooks"; +import { stopPropagation } from "../../../lib/stopPropagation"; + import { useIntermediate } from "../../../context/intermediate/Intermediate"; import { useClient } from "../../../context/revoltjs/RevoltClient"; -import UserShort from "../../../components/common/user/UserShort"; +import Tooltip from "../../../components/common/Tooltip"; +import UserIcon from "../../../components/common/user/UserIcon"; import Button from "../../../components/ui/Button"; import Checkbox from "../../../components/ui/Checkbox"; import InputBox from "../../../components/ui/InputBox"; import Overline from "../../../components/ui/Overline"; import Tip from "../../../components/ui/Tip"; +import CategoryButton from "../../../components/ui/fluent/CategoryButton"; interface Data { _id: string; @@ -20,6 +29,21 @@ interface Data { interactions_url?: string; } +const BotBadge = styled.div` + display: inline-block; + + height: 1.3em; + padding: 0px 4px; + font-size: 0.7em; + user-select: none; + margin-inline-start: 2px; + text-transform: uppercase; + + color: var(--foreground); + background: var(--accent); + border-radius: calc(var(--border-radius) / 2); +`; + function BotEditor({ bot }: { bot: Data }) { const client = useClient(); const [data, setData] = useState(bot); @@ -78,10 +102,11 @@ export const MyBots = observer(() => { }, []); const [name, setName] = useState(""); - const { writeClipboard } = useIntermediate(); + const [editMode, setEditMode] = useState(false); + const { writeClipboard, openScreen } = useIntermediate(); return ( -
+
This section is under construction. @@ -113,16 +138,80 @@ export const MyBots = observer(() => { key={bot._id} style={{ background: "var(--secondary-background)", - margin: "8px", + margin: "8px 0", padding: "12px", }}> - -

- token:{" "} - - {bot.token} - -

+
+
+ + openScreen({ + id: "profile", + user_id: user!._id, + }) + } + /> +
+
+ {user!.username}{" "} + + + +
+ + +
+
+ + + {bot.public ? : } + + {/* */} +
+ } + onClick={() => writeClipboard(bot.token)} + description={ + <> + {"••••••••••••••••••••••••••••••••••••"}{" "} + + stopPropagation( + ev, + openScreen({ + id: "token_reveal", + token: bot.token, + username: user!.username, + }), + ) + }> + + + + } + action={}> + Token +