mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-20 22:07:15 +00:00
chore: tweak frontend imports
This commit is contained in:
parent
5bf86601e6
commit
cc669f1be0
@ -3,8 +3,8 @@ import { useState } from "react";
|
|||||||
import { toast } from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { userServiceClient } from "@/grpcweb";
|
import { userServiceClient } from "@/grpcweb";
|
||||||
|
import useLoading from "@/hooks/useLoading";
|
||||||
import { useUserStore } from "@/stores";
|
import { useUserStore } from "@/stores";
|
||||||
import useLoading from "../hooks/useLoading";
|
|
||||||
import Icon from "./Icon";
|
import Icon from "./Icon";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -3,8 +3,8 @@ import { QRCodeCanvas } from "qrcode.react";
|
|||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { toast } from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { absolutifyLink } from "@/helpers/utils";
|
||||||
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
|
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
|
||||||
import { absolutifyLink } from "../helpers/utils";
|
|
||||||
import Icon from "./Icon";
|
import Icon from "./Icon";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -25,12 +25,12 @@ const GenerateQRCodeDialog: React.FC<Props> = (props: Props) => {
|
|||||||
const handleDownloadQRCodeClick = () => {
|
const handleDownloadQRCodeClick = () => {
|
||||||
const canvas = containerRef.current?.querySelector("canvas");
|
const canvas = containerRef.current?.querySelector("canvas");
|
||||||
if (!canvas) {
|
if (!canvas) {
|
||||||
toast.error("Failed to get qr code canvas");
|
toast.error("Failed to get QR code canvas");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.download = "filename.png";
|
link.download = `${shortcut.title || shortcut.name}-qrcode.png`;
|
||||||
link.href = canvas.toDataURL();
|
link.href = canvas.toDataURL();
|
||||||
link.click();
|
link.click();
|
||||||
handleCloseBtnClick();
|
handleCloseBtnClick();
|
||||||
@ -47,7 +47,7 @@ const GenerateQRCodeDialog: React.FC<Props> = (props: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div ref={containerRef} className="w-full flex flex-row justify-center items-center mt-2 mb-6">
|
<div ref={containerRef} className="w-full flex flex-row justify-center items-center mt-2 mb-6">
|
||||||
<QRCodeCanvas value={shortcutLink} size={128} bgColor={"#ffffff"} fgColor={"#000000"} includeMargin={false} level={"L"} />
|
<QRCodeCanvas value={shortcutLink} size={180} bgColor={"#ffffff"} fgColor={"#000000"} includeMargin={false} level={"L"} />
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row justify-center items-center px-4">
|
<div className="w-full flex flex-row justify-center items-center px-4">
|
||||||
<Button className="w-full" color="neutral" onClick={handleDownloadQRCodeClick}>
|
<Button className="w-full" color="neutral" onClick={handleDownloadQRCodeClick}>
|
||||||
|
@ -5,10 +5,10 @@ import { useEffect } from "react";
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { absolutifyLink } from "@/helpers/utils";
|
||||||
import { useUserStore, useViewStore } from "@/stores";
|
import { useUserStore, useViewStore } from "@/stores";
|
||||||
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
|
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
|
||||||
import { convertVisibilityFromPb } from "@/utils/visibility";
|
import { convertVisibilityFromPb } from "@/utils/visibility";
|
||||||
import { absolutifyLink } from "../helpers/utils";
|
|
||||||
import Icon from "./Icon";
|
import Icon from "./Icon";
|
||||||
import LinkFavicon from "./LinkFavicon";
|
import LinkFavicon from "./LinkFavicon";
|
||||||
import ShortcutActionsDropdown from "./ShortcutActionsDropdown";
|
import ShortcutActionsDropdown from "./ShortcutActionsDropdown";
|
||||||
@ -50,11 +50,11 @@ const ShortcutCard = (props: Props) => {
|
|||||||
>
|
>
|
||||||
<LinkFavicon url={shortcut.link} />
|
<LinkFavicon url={shortcut.link} />
|
||||||
</Link>
|
</Link>
|
||||||
<div className="ml-1 w-[calc(100%-24px)] flex flex-col justify-start items-start">
|
<div className="ml-2 w-[calc(100%-24px)] flex flex-col justify-start items-start">
|
||||||
<div className="w-full flex flex-row justify-start items-center">
|
<div className="w-full flex flex-row justify-start items-center leading-tight">
|
||||||
<a
|
<a
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"max-w-[calc(100%-36px)] flex flex-row px-1 mr-1 justify-start items-center cursor-pointer rounded-md hover:bg-gray-100 hover:shadow dark:hover:bg-zinc-800"
|
"max-w-[calc(100%-36px)] flex flex-row justify-start items-center mr-1 cursor-pointer hover:opacity-80 hover:underline"
|
||||||
)}
|
)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={shortcutLink}
|
href={shortcutLink}
|
||||||
@ -64,9 +64,7 @@ const ShortcutCard = (props: Props) => {
|
|||||||
{shortcut.title ? (
|
{shortcut.title ? (
|
||||||
<span className="text-gray-500">({shortcut.name})</span>
|
<span className="text-gray-500">({shortcut.name})</span>
|
||||||
) : (
|
) : (
|
||||||
<>
|
|
||||||
<span className="truncate dark:text-gray-400">{shortcut.name}</span>
|
<span className="truncate dark:text-gray-400">{shortcut.name}</span>
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<span className="hidden group-hover:block ml-1 cursor-pointer shrink-0">
|
<span className="hidden group-hover:block ml-1 cursor-pointer shrink-0">
|
||||||
@ -75,7 +73,7 @@ const ShortcutCard = (props: Props) => {
|
|||||||
</a>
|
</a>
|
||||||
<Tooltip title="Copy" variant="solid" placement="top" arrow>
|
<Tooltip title="Copy" variant="solid" placement="top" arrow>
|
||||||
<button
|
<button
|
||||||
className="hidden group-hover:block w-6 h-6 cursor-pointer rounded-md text-gray-500 hover:bg-gray-100 hover:shadow dark:hover:bg-zinc-800"
|
className="hidden group-hover:block cursor-pointer text-gray-500 hover:opacity-80"
|
||||||
onClick={() => handleCopyButtonClick()}
|
onClick={() => handleCopyButtonClick()}
|
||||||
>
|
>
|
||||||
<Icon.Clipboard className="w-4 h-auto mx-auto" />
|
<Icon.Clipboard className="w-4 h-auto mx-auto" />
|
||||||
@ -83,7 +81,7 @@ const ShortcutCard = (props: Props) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
className="pl-1 pr-4 w-full text-sm truncate text-gray-400 dark:text-gray-500 hover:underline"
|
className="pr-4 leading-tight w-full text-sm truncate text-gray-400 dark:text-gray-500 hover:underline"
|
||||||
href={shortcut.link}
|
href={shortcut.link}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ReactNode, useEffect, useRef, useState } from "react";
|
import { ReactNode, useEffect, useRef, useState } from "react";
|
||||||
import Icon from "../Icon";
|
import Icon from "@/components/Icon";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
trigger?: ReactNode;
|
trigger?: ReactNode;
|
||||||
|
@ -3,12 +3,12 @@ import copy from "copy-to-clipboard";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { toast } from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { showCommonDialog } from "@/components/Alert";
|
||||||
|
import CreateAccessTokenDialog from "@/components/CreateAccessTokenDialog";
|
||||||
|
import Icon from "@/components/Icon";
|
||||||
import { userServiceClient } from "@/grpcweb";
|
import { userServiceClient } from "@/grpcweb";
|
||||||
import { useUserStore } from "@/stores";
|
import { useUserStore } from "@/stores";
|
||||||
import { UserAccessToken } from "@/types/proto/api/v1/user_service";
|
import { UserAccessToken } from "@/types/proto/api/v1/user_service";
|
||||||
import { showCommonDialog } from "../Alert";
|
|
||||||
import CreateAccessTokenDialog from "../CreateAccessTokenDialog";
|
|
||||||
import Icon from "../Icon";
|
|
||||||
|
|
||||||
const listAccessTokens = async (userId: number) => {
|
const listAccessTokens = async (userId: number) => {
|
||||||
const { accessTokens } = await userServiceClient.listUserAccessTokens({
|
const { accessTokens } = await userServiceClient.listUserAccessTokens({
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { Button } from "@mui/joy";
|
import { Button } from "@mui/joy";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import ChangePasswordDialog from "@/components/ChangePasswordDialog";
|
||||||
|
import EditUserinfoDialog from "@/components/EditUserinfoDialog";
|
||||||
import { useUserStore } from "@/stores";
|
import { useUserStore } from "@/stores";
|
||||||
import { Role } from "@/types/proto/api/v1/user_service";
|
import { Role } from "@/types/proto/api/v1/user_service";
|
||||||
import ChangePasswordDialog from "../ChangePasswordDialog";
|
|
||||||
import EditUserinfoDialog from "../EditUserinfoDialog";
|
|
||||||
|
|
||||||
const AccountSection: React.FC = () => {
|
const AccountSection: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -2,12 +2,12 @@ import { Button, IconButton } from "@mui/joy";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { showCommonDialog } from "@/components/Alert";
|
||||||
|
import CreateUserDialog from "@/components/CreateUserDialog";
|
||||||
|
import Icon from "@/components/Icon";
|
||||||
import { useUserStore } from "@/stores";
|
import { useUserStore } from "@/stores";
|
||||||
import { User } from "@/types/proto/api/v1/user_service";
|
import { User } from "@/types/proto/api/v1/user_service";
|
||||||
import { convertRoleFromPb } from "@/utils/user";
|
import { convertRoleFromPb } from "@/utils/user";
|
||||||
import { showCommonDialog } from "../Alert";
|
|
||||||
import CreateUserDialog from "../CreateUserDialog";
|
|
||||||
import Icon from "../Icon";
|
|
||||||
|
|
||||||
const MemberSection = () => {
|
const MemberSection = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Option, Select } from "@mui/joy";
|
import { Option, Select } from "@mui/joy";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import BetaBadge from "@/components/BetaBadge";
|
||||||
import { useUserStore } from "@/stores";
|
import { useUserStore } from "@/stores";
|
||||||
import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v1/user_setting_service";
|
import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v1/user_setting_service";
|
||||||
import BetaBadge from "../BetaBadge";
|
|
||||||
|
|
||||||
const PreferenceSection: React.FC = () => {
|
const PreferenceSection: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -3,10 +3,10 @@ import { useEffect, useState } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CollectionView from "@/components/CollectionView";
|
import CollectionView from "@/components/CollectionView";
|
||||||
import CreateCollectionDrawer from "@/components/CreateCollectionDrawer";
|
import CreateCollectionDrawer from "@/components/CreateCollectionDrawer";
|
||||||
|
import FilterView from "@/components/FilterView";
|
||||||
|
import Icon from "@/components/Icon";
|
||||||
|
import useLoading from "@/hooks/useLoading";
|
||||||
import { useShortcutStore, useCollectionStore } from "@/stores";
|
import { useShortcutStore, useCollectionStore } from "@/stores";
|
||||||
import FilterView from "../components/FilterView";
|
|
||||||
import Icon from "../components/Icon";
|
|
||||||
import useLoading from "../hooks/useLoading";
|
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
showCreateCollectionDrawer: boolean;
|
showCreateCollectionDrawer: boolean;
|
||||||
|
@ -5,9 +5,9 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
import { authServiceClient } from "@/grpcweb";
|
import { authServiceClient } from "@/grpcweb";
|
||||||
|
import useLoading from "@/hooks/useLoading";
|
||||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||||
import { useUserStore, useWorkspaceStore } from "@/stores";
|
import { useUserStore, useWorkspaceStore } from "@/stores";
|
||||||
import useLoading from "../hooks/useLoading";
|
|
||||||
|
|
||||||
const SignIn: React.FC = () => {
|
const SignIn: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -5,9 +5,9 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
import { authServiceClient } from "@/grpcweb";
|
import { authServiceClient } from "@/grpcweb";
|
||||||
|
import useLoading from "@/hooks/useLoading";
|
||||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||||
import { useUserStore, useWorkspaceStore } from "@/stores";
|
import { useUserStore, useWorkspaceStore } from "@/stores";
|
||||||
import useLoading from "../hooks/useLoading";
|
|
||||||
|
|
||||||
const SignUp: React.FC = () => {
|
const SignUp: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import AccessTokenSection from "@/components/setting/AccessTokenSection";
|
||||||
|
import AccountSection from "@/components/setting/AccountSection";
|
||||||
import PreferenceSection from "@/components/setting/PreferenceSection";
|
import PreferenceSection from "@/components/setting/PreferenceSection";
|
||||||
import AccessTokenSection from "../components/setting/AccessTokenSection";
|
|
||||||
import AccountSection from "../components/setting/AccountSection";
|
|
||||||
|
|
||||||
const Setting: React.FC = () => {
|
const Setting: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -2,11 +2,11 @@ import { Alert, Button } from "@mui/joy";
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
|
import MemberSection from "@/components/setting/MemberSection";
|
||||||
|
import WorkspaceSection from "@/components/setting/WorkspaceSection";
|
||||||
import { useUserStore, useWorkspaceStore } from "@/stores";
|
import { useUserStore, useWorkspaceStore } from "@/stores";
|
||||||
import { stringifyPlanType } from "@/stores/subscription";
|
import { stringifyPlanType } from "@/stores/subscription";
|
||||||
import { Role } from "@/types/proto/api/v1/user_service";
|
import { Role } from "@/types/proto/api/v1/user_service";
|
||||||
import MemberSection from "../components/setting/MemberSection";
|
|
||||||
import WorkspaceSection from "../components/setting/WorkspaceSection";
|
|
||||||
|
|
||||||
const WorkspaceSetting: React.FC = () => {
|
const WorkspaceSetting: React.FC = () => {
|
||||||
const workspaceStore = useWorkspaceStore();
|
const workspaceStore = useWorkspaceStore();
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import { createBrowserRouter } from "react-router-dom";
|
import { createBrowserRouter } from "react-router-dom";
|
||||||
|
import App from "@/App";
|
||||||
|
import Root from "@/layouts/Root";
|
||||||
import CollectionDashboard from "@/pages/CollectionDashboard";
|
import CollectionDashboard from "@/pages/CollectionDashboard";
|
||||||
import CollectionSpace from "@/pages/CollectionSpace";
|
import CollectionSpace from "@/pages/CollectionSpace";
|
||||||
|
import Home from "@/pages/Home";
|
||||||
import NotFound from "@/pages/NotFound";
|
import NotFound from "@/pages/NotFound";
|
||||||
|
import ShortcutDetail from "@/pages/ShortcutDetail";
|
||||||
import ShortcutSpace from "@/pages/ShortcutSpace";
|
import ShortcutSpace from "@/pages/ShortcutSpace";
|
||||||
import SignIn from "@/pages/SignIn";
|
import SignIn from "@/pages/SignIn";
|
||||||
import SignUp from "@/pages/SignUp";
|
import SignUp from "@/pages/SignUp";
|
||||||
import SubscriptionSetting from "@/pages/SubscriptionSetting";
|
import SubscriptionSetting from "@/pages/SubscriptionSetting";
|
||||||
import UserSetting from "@/pages/UserSetting";
|
import UserSetting from "@/pages/UserSetting";
|
||||||
import WorkspaceSetting from "@/pages/WorkspaceSetting";
|
import WorkspaceSetting from "@/pages/WorkspaceSetting";
|
||||||
import App from "../App";
|
|
||||||
import Root from "../layouts/Root";
|
|
||||||
import Home from "../pages/Home";
|
|
||||||
import ShortcutDetail from "../pages/ShortcutDetail";
|
|
||||||
|
|
||||||
const router = createBrowserRouter([
|
const router = createBrowserRouter([
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user