chore: updates

This commit is contained in:
Tristan Yang
2023-05-25 16:07:47 +08:00
parent a654d44802
commit 8a7156df63
7 changed files with 27 additions and 16 deletions
+1 -3
View File
@@ -1,3 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" stroke="#101828" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="#667085" width="24" height="24" viewBox="0 0 24 24"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 153 B

+2 -2
View File
@@ -32,7 +32,7 @@ const LinkifyText = ({
email: ({ content, attributes: { href: link } }) => {
if (mentionTextOnly) return <>{content}</>;
return (
<a className="link" href={link} rel="noreferrer">
<a className="text-primary-500" href={link} rel="noreferrer">
{content}
</a>
);
@@ -42,7 +42,7 @@ const LinkifyText = ({
if (!url) return <>{content}</>;
return (
<>
<a className="link" target="_blank" href={link} rel="noreferrer">
<a className="text-primary-500" target="_blank" href={link} rel="noreferrer">
{content}
</a>
<URLPreview url={link} />
+16 -2
View File
@@ -1,5 +1,6 @@
import { FC, useCallback, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import clsx from "clsx";
import dayjs from "dayjs";
import IconTimer from "@/assets/icons/timer.svg";
@@ -14,9 +15,17 @@ type Props = {
mid: number;
expiresIn: number;
createAt: number;
enableRightLayout: boolean;
};
const ExpireTimer: FC<Props> = ({ mid, createAt, expiresIn, context, contextId }) => {
const ExpireTimer: FC<Props> = ({
enableRightLayout,
mid,
createAt,
expiresIn,
context,
contextId
}) => {
const [countdown, setCountdown] = useState<number | undefined>();
const dispatch = useDispatch();
const clearMsgFromClient = useCallback(() => {
@@ -73,7 +82,12 @@ const ExpireTimer: FC<Props> = ({ mid, createAt, expiresIn, context, contextId }
.toString()
.padStart(2, "0")}`;
return (
<div className="absolute bottom-1 right-2 text-xs text-gray-400 flex items-center gap-1 font-mono">
<div
className={clsx(
"absolute bottom-1 text-xs text-gray-400 flex items-center gap-1 font-mono",
enableRightLayout ? "left-2" : "right-2"
)}
>
<IconTimer className="w-4 h-4 stroke-slate-400" />
{formatted_countdown}
</div>
+1
View File
@@ -205,6 +205,7 @@ const Message: FC<IProps> = ({
{showExpire && (
<ExpireTimer
enableRightLayout={isSelf}
mid={message.mid}
context={context}
contextId={contextId}
+2 -2
View File
@@ -11,11 +11,11 @@ interface Props {
const RequireNoAuth: FC<Props> = ({ children, redirectTo = "/" }) => {
const { isLoading } = useGetInitializedQuery();
const { token, initialized } = useAppSelector((store) => store.authData);
const { token, initialized, guest } = useAppSelector((store) => store.authData);
if (isLoading) return null;
// 未初始化 则先走setup 流程
if (!initialized) return <Navigate to={`/onboarding`} replace />;
return token ? <Navigate to={redirectTo} replace /> : children;
return token && !guest ? <Navigate to={redirectTo} replace /> : children;
};
export default RequireNoAuth;
+2 -2
View File
@@ -99,8 +99,8 @@ const Toolbar: FC<Props> = ({
{sendVisible && (
<Tooltip placement="top" tip="Send">
<SendIcon
className={"w-6 h-6 cursor-pointer animate-zoomIn dark:stroke-gray-300"}
onClick={sendMessages}
className={"w-6 h-6 cursor-pointer animate-zoomIn dark:fill-gray-300"}
onClick={sendMessages.bind(null, undefined)}
/>
</Tooltip>
)}
+3 -5
View File
@@ -23,6 +23,7 @@ const GuestBlankPlaceholder = () => {
clearLocalData();
navigateTo("/login");
};
const qrUrl = `http://voce.chat/url?s=${encodeURIComponent(BASE_ORIGIN)}`;
return (
<section className="flex flex-col items-center text-center">
<h2 className="text-3xl text-gray-600 dark:text-gray-50 font-bold">
@@ -33,12 +34,9 @@ const GuestBlankPlaceholder = () => {
{t("guest_login_tip")}
</span>
<div className="w-44 h-44 self-center mb-4">
<QRCode
level="Q"
size={1200}
link={`https://voce.chat/login?s=${encodeURIComponent(BASE_ORIGIN)}`}
/>
<QRCode level="Q" size={1200} link={qrUrl} />
</div>
{process.env.NODE_ENV == "development" && <span>{qrUrl}</span>}
<Button onClick={handleSignIn} className="small">
{t("sign_in")}
</Button>