mirror of
https://github.com/Nezumi-2711/onedrive-vercel-index.git
synced 2026-09-22 13:38:45 +00:00
functioncomponent -> react.fc
This commit is contained in:
+2
-2
@@ -2,12 +2,12 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|||||||
|
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { FunctionComponent, useState } from 'react'
|
import { FC, useState } from 'react'
|
||||||
|
|
||||||
import { matchProtectedRoute } from '../utils/protectedRouteHandler'
|
import { matchProtectedRoute } from '../utils/protectedRouteHandler'
|
||||||
import useLocalStorage from '../utils/useLocalStorage'
|
import useLocalStorage from '../utils/useLocalStorage'
|
||||||
|
|
||||||
const Auth: FunctionComponent<{ redirect: string }> = ({ redirect }) => {
|
const Auth: FC<{ redirect: string }> = ({ redirect }) => {
|
||||||
const authTokenPath = matchProtectedRoute(redirect)
|
const authTokenPath = matchProtectedRoute(redirect)
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
import { ParsedUrlQuery } from 'querystring'
|
import { ParsedUrlQuery } from 'querystring'
|
||||||
import { FunctionComponent } from 'react'
|
|
||||||
|
|
||||||
const Breadcrumb: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) => {
|
const Breadcrumb: React.FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
const { path } = query
|
const { path } = query
|
||||||
if (Array.isArray(path)) {
|
if (Array.isArray(path)) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import emojiRegex from 'emoji-regex'
|
|||||||
import { useClipboard } from 'use-clipboard-copy'
|
import { useClipboard } from 'use-clipboard-copy'
|
||||||
|
|
||||||
import { ParsedUrlQuery } from 'querystring'
|
import { ParsedUrlQuery } from 'querystring'
|
||||||
import { FunctionComponent, MouseEventHandler, SetStateAction, useEffect, useRef, useState } from 'react'
|
import { FC, MouseEventHandler, SetStateAction, useEffect, useRef, useState } from 'react'
|
||||||
import { ImageDecorator } from 'react-viewer/lib/ViewerProps'
|
import { ImageDecorator } from 'react-viewer/lib/ViewerProps'
|
||||||
|
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
@@ -69,7 +69,7 @@ const queryToPath = (query?: ParsedUrlQuery) => {
|
|||||||
return '/'
|
return '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileListItem: FunctionComponent<{
|
const FileListItem: FC<{
|
||||||
fileContent: { id: string; name: string; size: number; file: Object; lastModifiedDateTime: string }
|
fileContent: { id: string; name: string; size: number; file: Object; lastModifiedDateTime: string }
|
||||||
}> = ({ fileContent: c }) => {
|
}> = ({ fileContent: c }) => {
|
||||||
const emojiIcon = emojiRegex().exec(c.name)
|
const emojiIcon = emojiRegex().exec(c.name)
|
||||||
@@ -107,7 +107,7 @@ const FileListItem: FunctionComponent<{
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Checkbox: FunctionComponent<{
|
const Checkbox: FC<{
|
||||||
checked: 0 | 1 | 2
|
checked: 0 | 1 | 2
|
||||||
onChange: () => void
|
onChange: () => void
|
||||||
title: string
|
title: string
|
||||||
@@ -152,7 +152,7 @@ const Checkbox: FunctionComponent<{
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Downloading: FunctionComponent<{ title: string }> = ({ title }) => {
|
const Downloading: FC<{ title: string }> = ({ title }) => {
|
||||||
return (
|
return (
|
||||||
<span title={title} className="p-2 rounded" role="status">
|
<span title={title} className="p-2 rounded" role="status">
|
||||||
<LoadingIcon
|
<LoadingIcon
|
||||||
@@ -164,7 +164,7 @@ const Downloading: FunctionComponent<{ title: string }> = ({ title }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileListing: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) => {
|
const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
|
||||||
const [imageViewerVisible, setImageViewerVisibility] = useState(false)
|
const [imageViewerVisible, setImageViewerVisibility] = useState(false)
|
||||||
const [activeImageIdx, setActiveImageIdx] = useState(0)
|
const [activeImageIdx, setActiveImageIdx] = useState(0)
|
||||||
const [selected, setSelected] = useState<{ [key: string]: boolean }>({})
|
const [selected, setSelected] = useState<{ [key: string]: boolean }>({})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FunctionComponent, useEffect, useRef, useState } from 'react'
|
import { FC, useEffect, useRef, useState } from 'react'
|
||||||
import { ReactReader } from 'react-reader'
|
import { ReactReader } from 'react-reader'
|
||||||
import type { Rendition } from 'epubjs'
|
import type { Rendition } from 'epubjs'
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ import Loading from '../Loading'
|
|||||||
import DownloadButtonGroup from '../DownloadBtnGtoup'
|
import DownloadButtonGroup from '../DownloadBtnGtoup'
|
||||||
import { DownloadBtnContainer } from './Containers'
|
import { DownloadBtnContainer } from './Containers'
|
||||||
|
|
||||||
const EPUBPreview: FunctionComponent<{ file: any }> = ({ file }) => {
|
const EPUBPreview: FC<{ file: any }> = ({ file }) => {
|
||||||
const [epubContainerWidth, setEpubContainerWidth] = useState(400)
|
const [epubContainerWidth, setEpubContainerWidth] = useState(400)
|
||||||
const epubContainer = useRef<HTMLDivElement>(null)
|
const epubContainer = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, FunctionComponent, CSSProperties } from 'react'
|
import { useEffect, FC, CSSProperties } from 'react'
|
||||||
import Prism from 'prismjs'
|
import Prism from 'prismjs'
|
||||||
import ReactMarkdown from 'react-markdown'
|
import ReactMarkdown from 'react-markdown'
|
||||||
import gfm from 'remark-gfm'
|
import gfm from 'remark-gfm'
|
||||||
@@ -14,7 +14,7 @@ import DownloadButtonGroup from '../DownloadBtnGtoup'
|
|||||||
import useFileContent from '../../utils/fetchOnMount'
|
import useFileContent from '../../utils/fetchOnMount'
|
||||||
import { DownloadBtnContainer, PreviewContainer } from './Containers'
|
import { DownloadBtnContainer, PreviewContainer } from './Containers'
|
||||||
|
|
||||||
const MarkdownPreview: FunctionComponent<{ file: any; path: string; standalone?: boolean }> = ({
|
const MarkdownPreview: FC<{ file: any; path: string; standalone?: boolean }> = ({
|
||||||
file,
|
file,
|
||||||
path,
|
path,
|
||||||
standalone = true,
|
standalone = true,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { FunctionComponent, useEffect, useRef, useState } from 'react'
|
import { FC, useEffect, useRef, useState } from 'react'
|
||||||
import Preview from 'preview-office-docs'
|
import Preview from 'preview-office-docs'
|
||||||
|
|
||||||
import DownloadButtonGroup from '../DownloadBtnGtoup'
|
import DownloadButtonGroup from '../DownloadBtnGtoup'
|
||||||
import { DownloadBtnContainer } from './Containers'
|
import { DownloadBtnContainer } from './Containers'
|
||||||
|
|
||||||
const OfficePreview: FunctionComponent<{ file: any }> = ({ file }) => {
|
const OfficePreview: FC<{ file: any }> = ({ file }) => {
|
||||||
const docContainer = useRef<HTMLDivElement>(null)
|
const docContainer = useRef<HTMLDivElement>(null)
|
||||||
const [docContainerWidth, setDocContainerWidth] = useState(600)
|
const [docContainerWidth, setDocContainerWidth] = useState(600)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { FunctionComponent } from 'react'
|
|
||||||
|
|
||||||
import DownloadButtonGroup from '../DownloadBtnGtoup'
|
import DownloadButtonGroup from '../DownloadBtnGtoup'
|
||||||
import { DownloadBtnContainer } from './Containers'
|
import { DownloadBtnContainer } from './Containers'
|
||||||
|
|
||||||
const PDFEmbedPreview: FunctionComponent<{ file: any }> = ({ file }) => {
|
const PDFEmbedPreview: React.FC<{ file: any }> = ({ file }) => {
|
||||||
// const url = `/api/proxy?url=${encodeURIComponent(file['@microsoft.graph.downloadUrl'])}&inline=true`
|
// const url = `/api/proxy?url=${encodeURIComponent(file['@microsoft.graph.downloadUrl'])}&inline=true`
|
||||||
const url = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(
|
const url = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(
|
||||||
file['@microsoft.graph.downloadUrl']
|
file['@microsoft.graph.downloadUrl']
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { FunctionComponent } from 'react'
|
|
||||||
import ReactPlayer from 'react-player'
|
import ReactPlayer from 'react-player'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useClipboard } from 'use-clipboard-copy'
|
import { useClipboard } from 'use-clipboard-copy'
|
||||||
@@ -8,7 +7,7 @@ import { getBaseUrl } from '../../utils/getBaseUrl'
|
|||||||
import { DownloadButton } from '../DownloadBtnGtoup'
|
import { DownloadButton } from '../DownloadBtnGtoup'
|
||||||
import { DownloadBtnContainer, PreviewContainer } from './Containers'
|
import { DownloadBtnContainer, PreviewContainer } from './Containers'
|
||||||
|
|
||||||
const VideoPreview: FunctionComponent<{ file: any }> = ({ file }) => {
|
const VideoPreview: React.FC<{ file: any }> = ({ file }) => {
|
||||||
const { asPath } = useRouter()
|
const { asPath } = useRouter()
|
||||||
const clipboard = useClipboard()
|
const clipboard = useClipboard()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user