chore: solve merge from main
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vocechat-web",
|
"name": "vocechat-web",
|
||||||
"version": "0.3.54",
|
"version": "0.3.55",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://voce.chat",
|
"homepage": "https://voce.chat",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+3
-1
@@ -12,8 +12,10 @@ let prices: Price[] = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
const official_dev = `https://dev.voce.chat`;
|
const official_dev = `https://dev.voce.chat`;
|
||||||
// const local_dev = `http://07333.qicp.vip:3030`;
|
|
||||||
const local_dev = official_dev;
|
const local_dev = official_dev;
|
||||||
|
|
||||||
|
// const local_dev = `http://07333.qicp.vip:3030`;
|
||||||
|
// const local_dev = `https://im.ttt.td`;
|
||||||
// const local_dev = `http://localhost:3333`;
|
// const local_dev = `http://localhost:3333`;
|
||||||
export const BASE_ORIGIN = process.env.REACT_APP_RELEASE
|
export const BASE_ORIGIN = process.env.REACT_APP_RELEASE
|
||||||
? `${location.origin}`
|
? `${location.origin}`
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import IconInvite from "../../assets/icons/placeholder.invite.svg";
|
|||||||
import IconDownload from "../../assets/icons/placeholder.download.svg";
|
import IconDownload from "../../assets/icons/placeholder.download.svg";
|
||||||
import UsersModal from "./UsersModal";
|
import UsersModal from "./UsersModal";
|
||||||
import { useAppSelector } from "../../app/store";
|
import { useAppSelector } from "../../app/store";
|
||||||
import useLicense from "../hook/useLicense";
|
|
||||||
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -25,11 +24,10 @@ const classes = {
|
|||||||
};
|
};
|
||||||
const BlankPlaceholder: FC<Props> = ({ type = "chat" }) => {
|
const BlankPlaceholder: FC<Props> = ({ type = "chat" }) => {
|
||||||
const { t } = useTranslation("welcome");
|
const { t } = useTranslation("welcome");
|
||||||
const { server, isAdmin } = useAppSelector((store) => { return { server: store.server, isAdmin: store.authData.user?.is_admin }; });
|
const { server, isAdmin, upgraded } = useAppSelector((store) => { return { server: store.server, isAdmin: store.authData.user?.is_admin, upgraded: store.server.upgraded }; });
|
||||||
const [inviteModalVisible, setInviteModalVisible] = useState(false);
|
const [inviteModalVisible, setInviteModalVisible] = useState(false);
|
||||||
const [createChannelVisible, setCreateChannelVisible] = useState(false);
|
const [createChannelVisible, setCreateChannelVisible] = useState(false);
|
||||||
const [userListVisible, setUserListVisible] = useState(false);
|
const [userListVisible, setUserListVisible] = useState(false);
|
||||||
const { upgraded } = useLicense();
|
|
||||||
const toggleChannelModalVisible = () => {
|
const toggleChannelModalVisible = () => {
|
||||||
setCreateChannelVisible((prev) => !prev);
|
setCreateChannelVisible((prev) => !prev);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,12 +77,11 @@ const Reply: FC<ReplyProps> = ({ mid, interactive = true }) => {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const defaultClass = `flex items-start flex-col md:flex-row p-2 bg-gray-100 dark:bg-gray-900 rounded-lg gap-2 mb-1`;
|
||||||
if (!data) return <div
|
if (!data) return <div
|
||||||
key={mid}
|
key={mid}
|
||||||
data-mid={mid}
|
data-mid={mid}
|
||||||
className={clsx(`flex items-start flex-col md:flex-row p-2 bg-gray-100 italic dark:bg-gray-900 rounded-lg gap-2 mb-1`,
|
className={clsx(defaultClass, 'italic')}
|
||||||
interactive ? "cursor-pointer" : "!bg-transparent"
|
|
||||||
)}
|
|
||||||
>{t("reply_msg_del")}</div>;
|
>{t("reply_msg_del")}</div>;
|
||||||
const currUser = users[data.from_uid || 0];
|
const currUser = users[data.from_uid || 0];
|
||||||
if (!currUser) return null;
|
if (!currUser) return null;
|
||||||
@@ -91,7 +90,7 @@ const Reply: FC<ReplyProps> = ({ mid, interactive = true }) => {
|
|||||||
<div
|
<div
|
||||||
key={mid}
|
key={mid}
|
||||||
data-mid={mid}
|
data-mid={mid}
|
||||||
className={clsx(`flex items-start flex-col md:flex-row p-2 bg-gray-100 dark:bg-gray-900 rounded-lg gap-2 mb-1`,
|
className={clsx(defaultClass,
|
||||||
interactive ? "cursor-pointer" : "!bg-transparent"
|
interactive ? "cursor-pointer" : "!bg-transparent"
|
||||||
)}
|
)}
|
||||||
onClick={interactive ? handleClick : undefined}
|
onClick={interactive ? handleClick : undefined}
|
||||||
|
|||||||
@@ -5,13 +5,15 @@ import {
|
|||||||
useUpsertLicenseMutation
|
useUpsertLicenseMutation
|
||||||
} from "../../app/services/server";
|
} from "../../app/services/server";
|
||||||
import { useAppSelector } from "../../app/store";
|
import { useAppSelector } from "../../app/store";
|
||||||
|
// type Props = {
|
||||||
const useLicense = () => {
|
// refetchOnMountOrArgChange?: boolean
|
||||||
|
// } | undefined
|
||||||
|
const useLicense = (refetchOnMountOrArgChange = false) => {
|
||||||
const { userCount, isGuest, upgraded } = useAppSelector((store) => {
|
const { userCount, isGuest, upgraded } = useAppSelector((store) => {
|
||||||
return { userCount: store.users.ids.length, isGuest: store.authData.guest, upgraded: store.server.upgraded };
|
return { userCount: store.users.ids.length, isGuest: store.authData.guest, upgraded: store.server.upgraded };
|
||||||
});
|
});
|
||||||
const { data: license, refetch: refetchLicense } = useGetLicenseQuery(undefined, {
|
const { data: license, refetch: refetchLicense, isLoading } = useGetLicenseQuery(undefined, {
|
||||||
refetchOnMountOrArgChange: true,
|
refetchOnMountOrArgChange,
|
||||||
skip: isGuest
|
skip: isGuest
|
||||||
});
|
});
|
||||||
const [check, { isLoading: isChecking, isSuccess: checked }] = useCheckLicenseMutation();
|
const [check, { isLoading: isChecking, isSuccess: checked }] = useCheckLicenseMutation();
|
||||||
@@ -40,6 +42,7 @@ const useLicense = () => {
|
|||||||
reachLimit: userCount >= lUserLimit,
|
reachLimit: userCount >= lUserLimit,
|
||||||
license,
|
license,
|
||||||
checked,
|
checked,
|
||||||
|
isLoading,
|
||||||
checking: isChecking,
|
checking: isChecking,
|
||||||
upserting,
|
upserting,
|
||||||
upserted,
|
upserted,
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ import { useLazyGetServerQuery } from "../../app/services/server";
|
|||||||
import useStreaming from "./useStreaming";
|
import useStreaming from "./useStreaming";
|
||||||
import { useAppSelector } from "../../app/store";
|
import { useAppSelector } from "../../app/store";
|
||||||
import { useLazyLoadMoreMessagesQuery } from "../../app/services/message";
|
import { useLazyLoadMoreMessagesQuery } from "../../app/services/message";
|
||||||
|
import useLicense from "./useLicense";
|
||||||
// type Props={
|
// type Props={
|
||||||
// guest?:boolean
|
// guest?:boolean
|
||||||
// }
|
// }
|
||||||
let preloadChannelMsgs = false;
|
let preloadChannelMsgs = false;
|
||||||
export default function usePreload() {
|
export default function usePreload() {
|
||||||
|
const { isLoading: loadingLicense } = useLicense(false);
|
||||||
const [preloadChannelMessages] = useLazyLoadMoreMessagesQuery();
|
const [preloadChannelMessages] = useLazyLoadMoreMessagesQuery();
|
||||||
const { rehydrate, rehydrated } = useRehydrate();
|
const { rehydrate, rehydrated } = useRehydrate();
|
||||||
const {
|
const {
|
||||||
@@ -85,7 +87,7 @@ export default function usePreload() {
|
|||||||
}, [canStreaming]);
|
}, [canStreaming]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: usersLoading || serverLoading || favoritesLoading || !rehydrated,
|
loading: usersLoading || serverLoading || favoritesLoading || !rehydrated || loadingLicense,
|
||||||
error: usersError && serverError && favoritesError,
|
error: usersError && serverError && favoritesError,
|
||||||
success: usersSuccess && serverSuccess && favoritesSuccess,
|
success: usersSuccess && serverSuccess && favoritesSuccess,
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ const Session: FC<IProps> = ({
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<span className={clsx("text-xs text-gray-500 dark:text-gray-400 truncate", unreads > 0 ? `w-36` : ``)}>{renderPreviewMessage(previewMsg)}</span>
|
<span className={clsx("text-xs text-gray-500 dark:text-gray-400 truncate", unreads > 0 ? `w-36` : ``)}>{renderPreviewMessage(previewMsg)}</span>
|
||||||
{unreads > 0 && !isCurrentPath && (
|
{unreads > 0 && !isCurrentPath && (
|
||||||
<strong className={clsx(`text-white h-5 min-w-[20px] bg-primary-400 font-bold text-[10px] rounded-[10px] flex-center`, unreads > 99 && 'w-1.5 !h-1.5 p-0 min-w-[unset]', muted && "bg-gray-500")}>
|
<strong className={clsx(`text-white px-1.5 py-[3px] bg-primary-400 font-bold text-[10px] leading-[10px] rounded-[10px]`, unreads > 99 && 'w-1.5 !h-1.5 p-0 min-w-[unset]', muted && "bg-gray-500")}>
|
||||||
{unreads > 99 ? null : unreads}
|
{unreads > 99 ? null : unreads}
|
||||||
</strong>
|
</strong>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink, useSearchParams } from 'react-router-dom';
|
||||||
import { isMobile } from '../../common/utils';
|
import { isMobile } from '../../common/utils';
|
||||||
|
|
||||||
export default function SignInLink({ token }: { token?: string }) {
|
export default function SignInLink({ token }: { token?: string }) {
|
||||||
const { t } = useTranslation("auth");
|
const { t } = useTranslation("auth");
|
||||||
|
let [searchParams] = useSearchParams(new URLSearchParams(location.search));
|
||||||
|
const ctx = searchParams.get("ctx") ?? "app";
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 移动端访问,则跳转
|
// 移动端访问,则跳转
|
||||||
if (isMobile() && !!token) {
|
if (isMobile() && !!token && ctx == "app") {
|
||||||
location.href = `https://join.voce.chat/download?link=${encodeURIComponent(`${location.origin}&magic_token=${token}`)}`;
|
location.href = `https://join.voce.chat/download?link=${encodeURIComponent(`${location.origin}?magic_token=${token}`)}`;
|
||||||
}
|
}
|
||||||
}, [token]);
|
}, [token, ctx]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-1 mt-7 text-sm text-slate-500 dark:text-gray-100 justify-center">
|
<div className="flex gap-1 mt-7 text-sm text-slate-500 dark:text-gray-100 justify-center">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const Item = ({ label, data, foldable = false, ...rest }: ItemProps) => {
|
|||||||
export default function License() {
|
export default function License() {
|
||||||
const { t, i18n } = useTranslation("setting");
|
const { t, i18n } = useTranslation("setting");
|
||||||
// const { t: ct } = useTranslation();
|
// const { t: ct } = useTranslation();
|
||||||
const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense();
|
const { license: licenseInfo, reachLimit, upsertLicense, upserting, upserted } = useLicense(true);
|
||||||
const [modalVisible, setModalVisible] = useState(false);
|
const [modalVisible, setModalVisible] = useState(false);
|
||||||
const [updateVisible, setUpdateVisible] = useState(false);
|
const [updateVisible, setUpdateVisible] = useState(false);
|
||||||
const [base58Fold, setBase58Fold] = useState(true);
|
const [base58Fold, setBase58Fold] = useState(true);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import Version from "../../common/component/Version";
|
|||||||
import ConfigAgora from "./config/Agora";
|
import ConfigAgora from "./config/Agora";
|
||||||
import { useAppSelector } from "../../app/store";
|
import { useAppSelector } from "../../app/store";
|
||||||
import ServerVersionChecker from "../../common/component/ServerVersionChecker";
|
import ServerVersionChecker from "../../common/component/ServerVersionChecker";
|
||||||
import useLicense from "../../common/hook/useLicense";
|
|
||||||
|
|
||||||
const navs = [
|
const navs = [
|
||||||
{
|
{
|
||||||
@@ -98,10 +97,9 @@ const navs = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const useNavs = () => {
|
const useNavs = () => {
|
||||||
const { upgraded } = useLicense();
|
|
||||||
const { t } = useTranslation("setting");
|
const { t } = useTranslation("setting");
|
||||||
const loginUser = useAppSelector((store) => {
|
const { loginUser, upgraded } = useAppSelector((store) => {
|
||||||
return store.authData.user;
|
return { loginUser: store.authData.user, upgraded: store.server.upgraded };
|
||||||
});
|
});
|
||||||
const transformedNavs = navs.map(n => {
|
const transformedNavs = navs.map(n => {
|
||||||
const { name, items, ...rest } = n;
|
const { name, items, ...rest } = n;
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ module.exports = {
|
|||||||
content: ["./src/**/*.{js,jsx,ts,tsx}", "./public/*.html"],
|
content: ["./src/**/*.{js,jsx,ts,tsx}", "./public/*.html"],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
|
fontSize: {
|
||||||
|
xs: ["0.75rem", "1.125rem"]
|
||||||
|
},
|
||||||
colors: {
|
colors: {
|
||||||
primary: {
|
primary: {
|
||||||
25: "#F5FEFF",
|
25: "#F5FEFF",
|
||||||
|
|||||||
Reference in New Issue
Block a user