chore: sort imports

This commit is contained in:
DarkSky
2022-08-13 03:16:26 +08:00
parent 5462b1707f
commit 754b2581cd
198 changed files with 839 additions and 917 deletions
@@ -1,5 +1,5 @@
import { BoardViewIcon, DocViewIcon } from '@toeverything/components/icons';
import { styled } from '@toeverything/components/ui';
import { DocViewIcon, BoardViewIcon } from '@toeverything/components/icons';
import { DocMode } from './type';
interface StatusIconProps {
@@ -1,6 +1,6 @@
import type { DocMode } from './type';
import { styled } from '@toeverything/components/ui';
import { StatusIcon } from './StatusIcon';
import type { DocMode } from './type';
interface StatusTrackProps {
mode: DocMode;
@@ -1,5 +1,5 @@
import { useLocation, useParams, useNavigate } from 'react-router-dom';
import { styled } from '@toeverything/components/ui';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { StatusText } from './StatusText';
import { StatusTrack } from './StatusTrack';
import { DocMode } from './type';
+10 -11
View File
@@ -1,24 +1,23 @@
import { useNavigate, useParams, useLocation } from 'react-router-dom';
import MenuIconBak from '@mui/icons-material/Menu';
import {
useUserAndSpaces,
useShowSpaceSidebar,
useShowSettingsSidebar,
} from '@toeverything/datasource/state';
import { ListIcon, LogoLink, SpaceIcon } from '@toeverything/components/common';
import { SideBarViewIcon } from '@toeverything/components/icons';
import {
MuiIconButton as IconButton,
styled,
Tooltip,
useTheme,
} from '@toeverything/components/ui';
import { SideBarViewIcon } from '@toeverything/components/icons';
import { LogoLink, ListIcon, SpaceIcon } from '@toeverything/components/common';
import { useFlag } from '@toeverything/datasource/feature-flags';
import {
useShowSettingsSidebar,
useShowSpaceSidebar,
useUserAndSpaces,
} from '@toeverything/datasource/state';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { PageHistoryPortal } from './PageHistoryPortal';
import { PageSharePortal } from './PageSharePortal';
import { PageSettingPortal } from './PageSettingPortal';
import { PageSharePortal } from './PageSharePortal';
import { CurrentPageTitle } from './Title';
import { UserMenuIcon } from './user-menu-icon';
import { useFlag } from '@toeverything/datasource/feature-flags';
function hideAffineHeader(pathname: string): boolean {
return ['/', '/login', '/error/workspace', '/error/404', '/ui'].includes(
@@ -1,19 +1,19 @@
import { useMemo } from 'react';
import { IconButton, styled } from '@toeverything/components/ui';
import {
LogoIcon,
SideBarViewIcon,
SearchIcon,
SideBarViewCloseIcon,
SideBarViewIcon,
} from '@toeverything/components/icons';
import { IconButton, styled } from '@toeverything/components/ui';
import {
useShowSettingsSidebar,
useLocalTrigger,
useShowSettingsSidebar,
} from '@toeverything/datasource/state';
import { EditorBoardSwitcher } from './EditorBoardSwitcher';
import { fsApiSupported, FileSystem } from './FileSystem';
import { FileSystem, fsApiSupported } from './FileSystem';
import { CurrentPageTitle } from './Title';
export const LayoutHeader = () => {
@@ -1,22 +1,22 @@
import { useState, MouseEvent, useCallback, useEffect } from 'react';
import { services } from '@toeverything/datasource/db-service';
import { useParams, useNavigate } from 'react-router-dom';
import { useCallback, useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { copyToClipboard } from '@toeverything/utils';
import { MoreIcon } from '@toeverything/components/icons';
import {
MuiSnackbar as Snackbar,
Popover,
ListButton,
MuiDivider as Divider,
MuiSnackbar as Snackbar,
MuiSwitch as Switch,
Popover,
styled,
} from '@toeverything/components/ui';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import format from 'date-fns/format';
import { useFlag } from '@toeverything/datasource/feature-flags';
import { PageBlock } from './types';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { copyToClipboard } from '@toeverything/utils';
import format from 'date-fns/format';
import { FileExporter } from './file-exporter/file-exporter';
import { PageBlock } from './types';
const PageSettingPortalContainer = styled('div')({
width: '320p',
padding: '15px',
@@ -1,18 +1,17 @@
import style9 from 'style9';
import LanguageIcon from '@mui/icons-material/Language';
import { useState, MouseEvent } from 'react';
import InsertLinkIcon from '@mui/icons-material/InsertLink';
import LanguageIcon from '@mui/icons-material/Language';
import ShareIcon from '@mui/icons-material/Share';
import {
MuiSnackbar as Snackbar,
MuiButton as Button,
MuiDivider as Divider,
MuiInputBase as InputBase,
MuiPaper as Paper,
MuiSnackbar as Snackbar,
MuiSwitch as Switch,
Popover,
} from '@toeverything/components/ui';
import { copyToClipboard } from '@toeverything/utils';
import { useState } from 'react';
import style9 from 'style9';
const styles = style9.create({
pageShareBox: {
+2 -2
View File
@@ -1,6 +1,6 @@
import { useEffect, useState, useCallback } from 'react';
import { styled, Typography } from '@toeverything/components/ui';
import { useCallback, useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { Typography, styled } from '@toeverything/components/ui';
import { services } from '@toeverything/datasource/db-service';
import { useUserAndSpaces } from '@toeverything/datasource/state';
@@ -1,4 +1,3 @@
import { PageBlock } from '../types';
import TurndownService from 'turndown';
const FileExporter = {
exportFile: (filename: string, text: string, format: string) => {
@@ -1,14 +1,14 @@
import { useMemo } from 'react';
import { getAuth, signOut } from 'firebase/auth';
import { useMemo } from 'react';
import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import {
MuiDivider as Divider,
MuiList as List,
MuiListItem as ListItem,
MuiListItemText as ListItemText,
} from '@toeverything/components/ui';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils';
export const UserMenuList = () => {
const { user } = useUserAndSpaces();
@@ -1,10 +1,10 @@
import { Fragment, useState, useEffect, useCallback } from 'react';
import { styled, MuiClickAwayListener } from '@toeverything/components/ui';
import { MuiClickAwayListener, styled } from '@toeverything/components/ui';
import { services } from '@toeverything/datasource/db-service';
import { Fragment, useCallback, useEffect, useState } from 'react';
import { QuotedContent } from './item/QuotedContent';
import { ReplyItem } from './item/ReplyItem';
import { ReplyInput } from './item/ReplyInput';
import { ReplyItem } from './item/ReplyItem';
import { CommentInfo } from './type';
export const CommentItem = (props: CommentInfo) => {
@@ -1,6 +1,6 @@
import { styled } from '@toeverything/components/ui';
import { useComments } from './use-comments';
import { CommentItem } from './CommentItem';
import { useComments } from './use-comments';
type CommentsProps = {
activeCommentId: string;
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { styled, MuiAvatar as Avatar } from '@toeverything/components/ui';
import { MuiAvatar as Avatar, styled } from '@toeverything/components/ui';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { getUserDisplayName } from '@toeverything/utils';
import { useMemo } from 'react';
type CommentedByUserProps = {
username: string;
@@ -1,5 +1,5 @@
import { styled } from '@toeverything/components/ui';
import { DoneIcon } from '@toeverything/components/icons';
import { styled } from '@toeverything/components/ui';
type QuotedContentProps = {
content: string;
@@ -1,10 +1,10 @@
import {
useState,
useCallback,
KeyboardEventHandler,
ChangeEvent,
} from 'react';
import { styled } from '@toeverything/components/ui';
import {
ChangeEvent,
KeyboardEventHandler,
useCallback,
useState,
} from 'react';
export const ReplyInput = (props: any) => {
const { onSubmit } = props;
@@ -1,4 +1,3 @@
import { styled } from '@toeverything/components/ui';
import type { CommentReply } from '@toeverything/datasource/db-service';
import { CommentContent } from './CommentContent';
@@ -1,11 +1,11 @@
import { useState, useCallback, useEffect, useMemo } from 'react';
import { useParams } from 'react-router-dom';
import { services } from '@toeverything/datasource/db-service';
import type { Virgo } from '@toeverything/components/editor-core';
import { services } from '@toeverything/datasource/db-service';
import {
useCurrentEditors,
useShowSettingsSidebar,
} from '@toeverything/datasource/state';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useParams } from 'react-router-dom';
import type { CommentInfo } from './type';
export const useComments = () => {
@@ -1,6 +1,6 @@
import type {
ReturnEditorBlock,
Comment,
ReturnEditorBlock,
} from '@toeverything/datasource/db-service';
export const getCommentsFromEditorBlocks = (
@@ -1,13 +1,13 @@
import { cloneElement, useMemo, useCallback, type ReactElement } from 'react';
import { styled } from '@toeverything/components/ui';
import {
CommentIcon,
LayoutIcon,
SettingsIcon,
} from '@toeverything/components/icons';
import { LayoutSettings } from '../Layout';
import { styled } from '@toeverything/components/ui';
import { cloneElement, useCallback, useMemo, type ReactElement } from 'react';
import { Comments } from '../Comments';
import { useActiveComment } from '../Comments/use-comments';
import { LayoutSettings } from '../Layout';
import { SettingsPanel } from '../Settings';
import { TabItemTitle } from './TabItemTitle';
import { useTabs } from './use-tabs';
@@ -1,5 +1,5 @@
import { ListIcon, ListItem, styled } from '@toeverything/components/ui';
import type { ReactNode } from 'react';
import { styled, ListItem, ListIcon } from '@toeverything/components/ui';
type TabItemTitleProps = {
icon: ReactNode;
@@ -1,4 +1,4 @@
import { useRef, useEffect, useState, useMemo } from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
function usePrevious<T>(value: T) {
const ref = useRef<T>();
@@ -1,4 +1,4 @@
import { styled, ListItem, Divider, Switch } from '@toeverything/components/ui';
import { Divider, ListItem, styled, Switch } from '@toeverything/components/ui';
import { useSettings } from './use-settings';
export const SettingsList = () => {
@@ -1,6 +1,6 @@
import { styled } from '@toeverything/components/ui';
import { SettingsList } from './SettingsList';
import { Footer } from './footer';
import { SettingsList } from './SettingsList';
export const SettingsPanel = () => {
return (
@@ -1,6 +1,6 @@
import format from 'date-fns/format';
import { Typography, styled } from '@toeverything/components/ui';
import { styled, Typography } from '@toeverything/components/ui';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import format from 'date-fns/format';
import { usePageLastUpdated, useWorkspaceAndPageId } from '../util';
export const LastModified = () => {
@@ -1,10 +1,5 @@
import { MoveToIcon } from '@toeverything/components/icons';
import {
ListItem,
ListIcon,
styled,
Typography,
} from '@toeverything/components/ui';
import { ListItem, styled, Typography } from '@toeverything/components/ui';
import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils';
import { getAuth, signOut } from 'firebase/auth';
@@ -1,17 +1,17 @@
import { useNavigate } from 'react-router-dom';
import { message } from '@toeverything/components/ui';
import { useSettingFlags, type SettingFlags } from './use-setting-flags';
import { copyToClipboard } from '@toeverything/utils';
import { useNavigate } from 'react-router-dom';
import { useSettingFlags, type SettingFlags } from './use-setting-flags';
import {
duplicatePage,
getPageTitle,
exportHtml,
exportMarkdown,
importWorkspace,
exportWorkspace,
useWorkspaceAndPageId,
// useReadingMode,
clearWorkspace,
duplicatePage,
exportHtml,
exportMarkdown,
exportWorkspace,
getPageTitle,
importWorkspace,
useWorkspaceAndPageId,
} from './util';
interface BaseSettingItem {
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
import { services } from '@toeverything/datasource/db-service';
import { useEffect, useState } from 'react';
const UNTITLED = 'untitled';
@@ -1,5 +1,5 @@
import { ClipboardParse } from '@toeverything/components/editor-core';
import { createEditor } from '@toeverything/components/affine-editor';
import { ClipboardParse } from '@toeverything/components/editor-core';
import { fileExporter } from './file-exporter';
interface CreateClipboardParseProps {
@@ -1,10 +1,10 @@
export { duplicatePage } from './duplicate-page';
export { exportHtml, exportMarkdown } from './handle-export';
export { getPageTitle, usePageLastUpdated } from './get-page-info';
export { exportHtml, exportMarkdown } from './handle-export';
export {
importWorkspace,
exportWorkspace,
clearWorkspace,
exportWorkspace,
importWorkspace,
} from './inspector-workspace';
export { useWorkspaceAndPageId } from './use-workspace-page';
export { useReadingMode } from './use-reading-mode';
export { useWorkspaceAndPageId } from './use-workspace-page';
@@ -1,15 +1,14 @@
import { services } from '@toeverything/datasource/db-service';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { useCallback, useEffect, useState } from 'react';
import { styled } from '@toeverything/components/ui';
import {
MuiList as List,
MuiListItem as ListItem,
MuiListItemText as ListItemText,
MuiListItemButton as ListItemButton,
styled,
} from '@toeverything/components/ui';
import { useNavigate } from 'react-router';
import { services } from '@toeverything/datasource/db-service';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { formatDistanceToNow } from 'date-fns';
import { useCallback, useEffect, useState } from 'react';
import { useNavigate } from 'react-router';
import { DotIcon } from '../dot-icon';
const StyledWrapper = styled('div')({
@@ -1,13 +1,12 @@
import { ComponentType, useEffect } from 'react';
import {
styled,
MuiBox as Box,
MuiTextField as TextField,
AdapterDateFns,
// CalendarPickerSkeleton,
LocalizationProvider,
AdapterDateFns,
MuiBox as Box,
MuiTextField as TextField,
StaticDatePicker,
} from '@toeverything/components/ui';
import { useEffect } from 'react';
import type { Theme } from './types';
import { useCalendarHeatmap } from './use-calendar-heatmap';
@@ -1,9 +1,9 @@
import type { ComponentType } from 'react';
import {
styled,
PickersDay,
styled,
type PickersDayProps,
} from '@toeverything/components/ui';
import type { ComponentType } from 'react';
import type { Theme } from './types';
import { DEFAULT_THEME } from './utils';
@@ -1,11 +1,10 @@
import { useCallback, useEffect, useState, createElement } from 'react';
import { atom, useAtom } from 'jotai';
import type { PickersDayProps } from '@toeverything/components/ui';
import { atom, useAtom } from 'jotai';
import { createElement, useCallback, useState } from 'react';
import type { CalendarDay } from './types';
import type { CalendarHeatmapProps } from './CalendarHeatmap';
import { HeatedDay } from './HeatedDay';
import { fakeFetch, fetchActivitiesHeatmap } from './utils';
import type { CalendarDay } from './types';
// import { usePageTree } from 'PageTree';
const highlightedDaysAtom = atom<CalendarDay[] | undefined>([]);
@@ -6,7 +6,7 @@ import { getDateIsoStringWithTimezone } from '@toeverything/utils';
import getDaysInMonth from 'date-fns/getDaysInMonth';
import color, { ColorInput } from 'tinycolor2';
import type { Theme, CalendarDay } from './types';
import type { CalendarDay, Theme } from './types';
// export const DEFAULT_THEME = createCalendarTheme('#3E6FDB');
export const DEFAULT_THEME: Theme = {
@@ -1,3 +1,3 @@
export * from './page-tree';
export * from './calendar-heatmap';
export * from './activities';
export * from './calendar-heatmap';
export * from './page-tree';
@@ -1,12 +1,12 @@
import React, { useMemo } from 'react';
import { useMemo } from 'react';
import {
defaultDropAnimation,
DndContext,
DragOverlay,
DropAnimation,
MeasuringStrategy,
PointerSensor,
defaultDropAnimation,
useSensor,
useSensors,
} from '@dnd-kit/core';
@@ -1,6 +1,5 @@
export { PageTree } from './PageTree';
export * from './types';
export { usePageTree } from './use-page-tree';
export * from './types';
// export { getRecentPages, setRecentPages } from './block-page';
@@ -1,4 +1,4 @@
import React, { CSSProperties } from 'react';
import { CSSProperties } from 'react';
import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
@@ -1,26 +1,15 @@
import React, {
useState,
MouseEvent,
useCallback,
useEffect,
useRef,
} from 'react';
import { services, TemplateFactory } from '@toeverything/datasource/db-service';
import { useParams, useNavigate } from 'react-router-dom';
import React, { useRef, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { copyToClipboard } from '@toeverything/utils';
import { ViewSidebarIcon } from '@toeverything/components/common';
import {
MuiSnackbar as Snackbar,
MuiPopover as Popover,
ListButton,
MuiDivider as Divider,
MuiSwitch as Switch,
styled,
BaseButton,
ListButton,
MuiPopover as Popover,
styled,
} from '@toeverything/components/ui';
import { useUserAndSpaces } from '@toeverything/datasource/state';
import { useFlag } from '@toeverything/datasource/feature-flags';
import { useUserAndSpaces } from '@toeverything/datasource/state';
const NewFromTemplatePortalContainer = styled('div')({
width: '320p',
padding: '15px',
@@ -7,8 +7,8 @@ import { useParams } from 'react-router-dom';
import { useFlag } from '@toeverything/datasource/feature-flags';
import MoreActions from './MoreActions';
import { DotIcon } from '../../dot-icon';
import MoreActions from './MoreActions';
import {
ActionButton,
Counter,
@@ -1,13 +1,8 @@
import { useCallback, useMemo, useState, useEffect } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { atom, useAtom } from 'jotai';
import type {
DragEndEvent,
DragMoveEvent,
DragOverEvent,
DragStartEvent,
} from '@dnd-kit/core';
import type { DragEndEvent, DragMoveEvent } from '@dnd-kit/core';
import { arrayMove } from '@dnd-kit/sortable';
import { atom, useAtom } from 'jotai';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { services } from '@toeverything/datasource/db-service';
import type { DndTreeProps } from './DndTree';