refactor: update api version

This commit is contained in:
Steven
2024-02-19 20:45:54 +08:00
parent b5f5ae2483
commit fafacc92eb
103 changed files with 2140 additions and 3986 deletions

View File

@ -3,8 +3,8 @@ import { useStorage } from "@plasmohq/storage/hook";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import useShortcutStore from "@/store/shortcut";
import { Visibility } from "@/types/proto/api/v2/common";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Visibility } from "@/types/proto/api/v1/common";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import Icon from "./Icon";
interface State {

View File

@ -1,7 +1,7 @@
import { useStorage } from "@plasmohq/storage/hook";
import classNames from "classnames";
import { getFaviconWithGoogleS2 } from "@/helpers/utils";
import type { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import type { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import Icon from "./Icon";
interface Props {

View File

@ -1,7 +1,7 @@
import axios from "axios";
import { create } from "zustand";
import { combine } from "zustand/middleware";
import { CreateShortcutResponse, ListShortcutsResponse, Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { CreateShortcutResponse, ListShortcutsResponse, Shortcut } from "@/types/proto/api/v1/shortcut_service";
interface State {
shortcutMapById: Record<number, Shortcut>;

View File

@ -2,7 +2,7 @@ import classNames from "classnames";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { shortcutServiceClient } from "@/grpcweb";
import { GetShortcutAnalyticsResponse } from "@/types/proto/api/v2/shortcut_service";
import { GetShortcutAnalyticsResponse } from "@/types/proto/api/v1/shortcut_service";
import Icon from "./Icon";
interface Props {

View File

@ -10,8 +10,8 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth";
import useCollectionStore from "@/stores/v1/collection";
import useShortcutStore from "@/stores/v1/shortcut";
import useUserStore from "@/stores/v1/user";
import { Collection } from "@/types/proto/api/v2/collection_service";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Collection } from "@/types/proto/api/v1/collection_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { showCommonDialog } from "./Alert";
import CreateCollectionDialog from "./CreateCollectionDrawer";
import Icon from "./Icon";

View File

@ -5,9 +5,9 @@ import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import useCollectionStore from "@/stores/v1/collection";
import useShortcutStore from "@/stores/v1/shortcut";
import { Collection } from "@/types/proto/api/v2/collection_service";
import { Visibility } from "@/types/proto/api/v2/common";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Collection } from "@/types/proto/api/v1/collection_service";
import { Visibility } from "@/types/proto/api/v1/common";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { convertVisibilityFromPb } from "@/utils/visibility";
import useLoading from "../hooks/useLoading";
import Icon from "./Icon";

View File

@ -17,8 +17,8 @@ import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import useShortcutStore, { getShortcutUpdateMask } from "@/stores/v1/shortcut";
import { Visibility } from "@/types/proto/api/v2/common";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Visibility } from "@/types/proto/api/v1/common";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { convertVisibilityFromPb } from "@/utils/visibility";
import useLoading from "../hooks/useLoading";
import Icon from "./Icon";

View File

@ -3,7 +3,7 @@ import { isUndefined } from "lodash-es";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Role, User } from "@/types/proto/api/v2/user_service";
import { Role, User } from "@/types/proto/api/v1/user_service";
import useLoading from "../hooks/useLoading";
import useUserStore from "../stores/v1/user";
import Icon from "./Icon";

View File

@ -3,7 +3,7 @@ import { QRCodeCanvas } from "qrcode.react";
import { useRef } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { absolutifyLink } from "../helpers/utils";
import Icon from "./Icon";

View File

@ -4,8 +4,8 @@ import { useTranslation } from "react-i18next";
import { Link, useLocation } from "react-router-dom";
import { authServiceClient } from "@/grpcweb";
import useWorkspaceStore from "@/stores/v1/workspace";
import { PlanType } from "@/types/proto/api/v2/subscription_service";
import { Role } from "@/types/proto/api/v2/user_service";
import { PlanType } from "@/types/proto/api/v1/subscription_service";
import { Role } from "@/types/proto/api/v1/user_service";
import useUserStore from "../stores/v1/user";
import AboutDialog from "./AboutDialog";
import Icon from "./Icon";

View File

@ -2,8 +2,8 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import useNavigateTo from "@/hooks/useNavigateTo";
import useShortcutStore from "@/stores/v1/shortcut";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Role } from "@/types/proto/api/v2/user_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { Role } from "@/types/proto/api/v1/user_service";
import useUserStore from "../stores/v1/user";
import { showCommonDialog } from "./Alert";
import CreateShortcutDrawer from "./CreateShortcutDrawer";

View File

@ -6,7 +6,7 @@ import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import useUserStore from "@/stores/v1/user";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { convertVisibilityFromPb } from "@/utils/visibility";
import { absolutifyLink, getFaviconWithGoogleS2 } from "../helpers/utils";
import useViewStore from "../stores/v1/view";

View File

@ -2,7 +2,7 @@ import { Divider } from "@mui/joy";
import classNames from "classnames";
import { Link } from "react-router-dom";
import { getFaviconWithGoogleS2 } from "@/helpers/utils";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import Icon from "./Icon";
interface Props {

View File

@ -1,6 +1,6 @@
import classNames from "classnames";
import { Link } from "react-router-dom";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { getFaviconWithGoogleS2 } from "../helpers/utils";
import Icon from "./Icon";
import ShortcutActionsDropdown from "./ShortcutActionsDropdown";

View File

@ -1,6 +1,6 @@
import classNames from "classnames";
import useNavigateTo from "@/hooks/useNavigateTo";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import useViewStore from "../stores/v1/view";
import ShortcutCard from "./ShortcutCard";
import ShortcutView from "./ShortcutView";

View File

@ -1,4 +1,4 @@
import { Visibility } from "@/types/proto/api/v2/common";
import { Visibility } from "@/types/proto/api/v1/common";
import Icon from "./Icon";
interface Props {

View File

@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { userServiceClient } from "@/grpcweb";
import { UserAccessToken } from "@/types/proto/api/v2/user_service";
import { UserAccessToken } from "@/types/proto/api/v1/user_service";
import useUserStore from "../../stores/v1/user";
import { showCommonDialog } from "../Alert";
import CreateAccessTokenDialog from "../CreateAccessTokenDialog";

View File

@ -1,7 +1,7 @@
import { Button } from "@mui/joy";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Role } from "@/types/proto/api/v2/user_service";
import { Role } from "@/types/proto/api/v1/user_service";
import useUserStore from "../../stores/v1/user";
import ChangePasswordDialog from "../ChangePasswordDialog";
import EditUserinfoDialog from "../EditUserinfoDialog";

View File

@ -2,7 +2,7 @@ import { Button, IconButton } from "@mui/joy";
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { User } from "@/types/proto/api/v2/user_service";
import { User } from "@/types/proto/api/v1/user_service";
import { convertRoleFromPb } from "@/utils/user";
import useUserStore from "../../stores/v1/user";
import { showCommonDialog } from "../Alert";

View File

@ -1,6 +1,6 @@
import { Option, Select } from "@mui/joy";
import { useTranslation } from "react-i18next";
import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service";
import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v1/user_setting_service";
import useUserStore from "../../stores/v1/user";
import BetaBadge from "../BetaBadge";

View File

@ -5,7 +5,7 @@ import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { workspaceServiceClient } from "@/grpcweb";
import useWorkspaceStore from "@/stores/v1/workspace";
import { WorkspaceSetting } from "@/types/proto/api/v2/workspace_service";
import { WorkspaceSetting } from "@/types/proto/api/v1/workspace_service";
const WorkspaceSection: React.FC = () => {
const { t } = useTranslation();

View File

@ -1,11 +1,11 @@
import { createChannel, createClientFactory, FetchTransport } from "nice-grpc-web";
import { AuthServiceDefinition } from "./types/proto/api/v2/auth_service";
import { CollectionServiceDefinition } from "./types/proto/api/v2/collection_service";
import { ShortcutServiceDefinition } from "./types/proto/api/v2/shortcut_service";
import { SubscriptionServiceDefinition } from "./types/proto/api/v2/subscription_service";
import { UserServiceDefinition } from "./types/proto/api/v2/user_service";
import { UserSettingServiceDefinition } from "./types/proto/api/v2/user_setting_service";
import { WorkspaceServiceDefinition } from "./types/proto/api/v2/workspace_service";
import { AuthServiceDefinition } from "./types/proto/api/v1/auth_service";
import { CollectionServiceDefinition } from "./types/proto/api/v1/collection_service";
import { ShortcutServiceDefinition } from "./types/proto/api/v1/shortcut_service";
import { SubscriptionServiceDefinition } from "./types/proto/api/v1/subscription_service";
import { UserServiceDefinition } from "./types/proto/api/v1/user_service";
import { UserSettingServiceDefinition } from "./types/proto/api/v1/user_setting_service";
import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service";
const address = import.meta.env.MODE === "development" ? "http://localhost:8082" : window.location.origin;

View File

@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
import { Outlet } from "react-router-dom";
import Navigator from "@/components/Navigator";
import useNavigateTo from "@/hooks/useNavigateTo";
import { UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service";
import { UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v1/user_setting_service";
import Header from "../components/Header";
import useUserStore from "../stores/v1/user";

View File

@ -10,8 +10,8 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth";
import useCollectionStore from "@/stores/v1/collection";
import useShortcutStore from "@/stores/v1/shortcut";
import useUserStore from "@/stores/v1/user";
import { Collection } from "@/types/proto/api/v2/collection_service";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Collection } from "@/types/proto/api/v1/collection_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
const CollectionSpace = () => {
const params = useParams();

View File

@ -8,8 +8,8 @@ import { useParams } from "react-router-dom";
import useLoading from "@/hooks/useLoading";
import useNavigateTo from "@/hooks/useNavigateTo";
import useShortcutStore from "@/stores/v1/shortcut";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Role } from "@/types/proto/api/v2/user_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { Role } from "@/types/proto/api/v1/user_service";
import { convertVisibilityFromPb } from "@/utils/visibility";
import { showCommonDialog } from "../components/Alert";
import AnalyticsView from "../components/AnalyticsView";

View File

@ -7,7 +7,7 @@ import { isURL } from "@/helpers/utils";
import useNavigateTo from "@/hooks/useNavigateTo";
import useShortcutStore from "@/stores/v1/shortcut";
import useUserStore from "@/stores/v1/user";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
const ShortcutSpace = () => {
const params = useParams();

View File

@ -3,6 +3,7 @@ import React, { FormEvent, useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import Icon from "@/components/Icon";
import { authServiceClient } from "@/grpcweb";
import useNavigateTo from "@/hooks/useNavigateTo";
import useUserStore from "@/stores/v1/user";
@ -64,7 +65,7 @@ const SignIn: React.FC = () => {
<div className="w-80 max-w-full h-full py-4 flex flex-col justify-start items-center">
<div className="w-full py-4 grow flex flex-col justify-center items-center">
<div className="flex flex-row justify-start items-center w-auto mx-auto gap-y-2 mb-4">
<img id="logo-img" src="/logo.png" className="w-12 h-auto mr-2 -mt-1 rounded-full shadow" alt="logo" />
<Icon.CircleSlash className="w-12 h-auto dark:text-gray-500 mr-2" strokeWidth={1.5} />
<span className="text-3xl opacity-80 dark:text-gray-500">Slash</span>
</div>
<form className="w-full mt-6" onSubmit={handleSigninBtnClick}>

View File

@ -6,8 +6,8 @@ import SubscriptionFAQ from "@/components/SubscriptionFAQ";
import { subscriptionServiceClient } from "@/grpcweb";
import { stringifyPlanType } from "@/stores/v1/subscription";
import useWorkspaceStore from "@/stores/v1/workspace";
import { PlanType } from "@/types/proto/api/v2/subscription_service";
import { Role } from "@/types/proto/api/v2/user_service";
import { PlanType } from "@/types/proto/api/v1/subscription_service";
import { Role } from "@/types/proto/api/v1/user_service";
import useUserStore from "../stores/v1/user";
const SubscriptionSetting: React.FC = () => {

View File

@ -4,7 +4,7 @@ import { Link } from "react-router-dom";
import Icon from "@/components/Icon";
import { stringifyPlanType } from "@/stores/v1/subscription";
import useWorkspaceStore from "@/stores/v1/workspace";
import { Role } from "@/types/proto/api/v2/user_service";
import { Role } from "@/types/proto/api/v1/user_service";
import MemberSection from "../components/setting/MemberSection";
import WorkspaceSection from "../components/setting/WorkspaceSection";
import useUserStore from "../stores/v1/user";

View File

@ -1,6 +1,6 @@
import { create } from "zustand";
import { collectionServiceClient } from "@/grpcweb";
import { Collection } from "@/types/proto/api/v2/collection_service";
import { Collection } from "@/types/proto/api/v1/collection_service";
interface CollectionState {
collectionMapById: Record<number, Collection>;

View File

@ -2,7 +2,7 @@ import { isEqual } from "lodash-es";
import { create } from "zustand";
import { combine } from "zustand/middleware";
import { shortcutServiceClient } from "@/grpcweb";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
interface State {
shortcutMapById: Record<number, Shortcut>;

View File

@ -1,4 +1,4 @@
import { PlanType } from "@/types/proto/api/v2/subscription_service";
import { PlanType } from "@/types/proto/api/v1/subscription_service";
export const stringifyPlanType = (planType: PlanType) => {
if (planType === PlanType.FREE) {

View File

@ -1,7 +1,7 @@
import { create } from "zustand";
import { authServiceClient, userServiceClient, userSettingServiceClient } from "@/grpcweb";
import { User } from "@/types/proto/api/v2/user_service";
import { UserSetting } from "@/types/proto/api/v2/user_setting_service";
import { User } from "@/types/proto/api/v1/user_service";
import { UserSetting } from "@/types/proto/api/v1/user_setting_service";
interface UserState {
userMapById: Record<number, User>;

View File

@ -1,8 +1,8 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { Visibility } from "@/types/proto/api/v2/common";
import { Shortcut } from "@/types/proto/api/v2/shortcut_service";
import { User } from "@/types/proto/api/v2/user_service";
import { Visibility } from "@/types/proto/api/v1/common";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { User } from "@/types/proto/api/v1/user_service";
export interface Filter {
tab?: string;

View File

@ -1,6 +1,6 @@
import { create } from "zustand";
import { workspaceServiceClient } from "@/grpcweb";
import { WorkspaceProfile, WorkspaceSetting } from "@/types/proto/api/v2/workspace_service";
import { WorkspaceProfile, WorkspaceSetting } from "@/types/proto/api/v1/workspace_service";
interface WorkspaceState {
profile: WorkspaceProfile;

View File

@ -1,4 +1,4 @@
import { Role } from "@/types/proto/api/v2/user_service";
import { Role } from "@/types/proto/api/v1/user_service";
export const convertRoleFromPb = (role: Role): string => {
if (role === Role.ADMIN) {

View File

@ -1,4 +1,4 @@
import { Visibility } from "@/types/proto/api/v2/common";
import { Visibility } from "@/types/proto/api/v1/common";
export const convertVisibilityFromPb = (visibility: Visibility): string => {
if (visibility === Visibility.PRIVATE) {