feat: add changelog entry in preparation for update

This commit is contained in:
Paul Makles
2023-06-11 17:31:22 +01:00
parent 75d07ffe0f
commit f20ada7c49
11 changed files with 232 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ import { history } from "../../context/history";
import AddFriend from "./components/AddFriend";
import BanMember from "./components/BanMember";
import Changelog from "./components/Changelog";
import ChangelogUsernames from "./components/ChangelogUsernames";
import ChannelInfo from "./components/ChannelInfo";
import Clipboard from "./components/Clipboard";
import ConfirmLeave from "./components/ConfirmLeave";
@@ -282,4 +283,5 @@ export const modalController = new ModalControllerExtended({
report: ReportContent,
report_success: ReportSuccess,
modify_displayname: ModifyDisplayname,
changelog_usernames: ChangelogUsernames,
});

View File

@@ -33,6 +33,8 @@ function RenderLog({ post }: { post: ChangelogPost }) {
{post.content.map((entry) =>
typeof entry === "string" ? (
<Markdown content={entry} />
) : entry.type === "element" ? (
entry.element
) : (
<Image src={entry.src} shadow={entry.shadow} />
),

View File

@@ -0,0 +1,146 @@
import Lottie, { LottieRefCurrentProps } from "lottie-react";
import { useEffect, useRef } from "preact/hooks";
import { Button, Column, InputBox, Modal, Row } from "@revoltchat/ui";
import { useClient } from "../../client/ClientController";
import { modalController } from "../ModalController";
import { ModalProps } from "../types";
import usernameAnim from "./legacy/usernameUpdateLottie.json";
/**
* Changelog: Username update
*/
export default function ChangelogUsernames({
onClose,
signal,
}: ModalProps<"changelog_usernames">) {
const client = useClient();
const lottieRef = useRef<LottieRefCurrentProps>();
useEffect(() => {
if (lottieRef.current) {
const timer = setTimeout(() => lottieRef.current!.play(), 2500);
return () => clearTimeout(timer);
}
}, [lottieRef]);
return (
<Modal onClose={onClose} signal={signal} transparent>
{
(
<Column gap="0">
<div
style={{
background: "black",
borderStartStartRadius: "12px",
borderStartEndRadius: "12px",
display: "grid",
placeItems: "center",
padding: "1.5em",
}}>
<Lottie
lottieRef={lottieRef as never}
animationData={usernameAnim}
autoplay={false}
loop={false}
style={{ width: "240px" }}
/>
</div>
<div
style={{
padding: "1em",
background: "var(--secondary-header)",
textAlign: "center",
}}>
<Column
gap="6px"
style={{
alignItems: "center",
}}>
<span
style={{
fontSize: "1.5em",
fontWeight: 700,
marginBottom: "12px",
}}>
Usernames are Changing
</span>
<span
style={{
color: "var(--secondary-foreground)",
fontSize: "0.9em",
fontWeight: 500,
}}>
We've changed how usernames work on Revolt.
Now you can set a display name in addition
to a username with a number tag for easier
sharing.
</span>
<span
style={{
color: "var(--secondary-foreground)",
fontSize: "0.9em",
fontWeight: 500,
}}>
Here's how your new username looks:
</span>
<InputBox
value={
client.user!.display_name ??
client.user!.username
}
style={{
maxWidth: "180px",
}}
disabled
/>
<InputBox
value={
client.user.username +
"#" +
client.user.discriminator
}
style={{
maxWidth: "180px",
}}
disabled
/>
<a
href="https://revolt.chat/posts/evolving-usernames"
target="_blank">
Read more about this change
</a>
</Column>
</div>
<Row
style={{
padding: "1em",
borderEndStartRadius: "12px",
borderEndEndRadius: "12px",
background: "var(--secondary-background)",
textAlign: "center",
justifyContent: "end",
}}>
<Button palette="plain" onClick={onClose}>
Skip for now
</Button>
<Button
palette="accent"
onClick={() => {
modalController.openLink(
"/settings/profile",
);
onClose();
}}>
Edit Profile
</Button>
</Row>
</Column>
) as any
}
</Modal>
);
}

View File

@@ -170,9 +170,8 @@ export default function ModifyAccount({
{field === "username" && (
<div style={{ marginTop: "8px" }}>
<Tip palette="warning">
Changing your username may change your
discriminator. You can freely change the case of
your username.
Changing your username may change your number tag.
You can freely change the case of your username.
</Tip>
</div>
)}

View File

@@ -72,9 +72,8 @@ export function OnboardingModal({
/>
</div>
<p>
You will be automatically assigned a
discriminator which you can find from
settings.
You will be automatically assigned a number
tag which you can find from settings.
</p>
<Button palette="accent">
{"Looks good!"}

File diff suppressed because one or more lines are too long

View File

@@ -41,6 +41,7 @@ export type Modal = {
type: "changelog";
initial?: number;
}
| { type: "changelog_usernames" }
| {
type: "sign_out_sessions";
client: Client;