diff --git a/components/Breadcrumb.tsx b/components/Breadcrumb.tsx index 1a7563c..2e7fa48 100644 --- a/components/Breadcrumb.tsx +++ b/components/Breadcrumb.tsx @@ -8,14 +8,14 @@ const Breadcrumb: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) => const { path } = query if (Array.isArray(path)) { return ( -
-
+
+
🚩 Home
{path.map((q: string, i: number) => (
/
-
+
= ({ query }) => } return ( -
+
🚩 Home
diff --git a/components/FileListing.tsx b/components/FileListing.tsx index 792387a..7e8604b 100644 --- a/components/FileListing.tsx +++ b/components/FileListing.tsx @@ -60,10 +60,7 @@ const queryToPath = (query?: ParsedUrlQuery) => { return '/' } -const fetcher = (url: string) => { - console.log(url) - return axios.get(url).then(res => res.data) -} +const fetcher = (url: string) => axios.get(url).then(res => res.data) const FileListItem: FunctionComponent<{ fileContent: { id: string; name: string; size: number; file: Object; lastModifiedDateTime: string } @@ -72,7 +69,7 @@ const FileListItem: FunctionComponent<{ const renderEmoji = emojiIcon && !emojiIcon.index return ( -
+
{/*
{c.file ? c.file.mimeType : 'folder'}
*/}
@@ -86,7 +83,7 @@ const FileListItem: FunctionComponent<{ {renderEmoji ? c.name.replace(emojiIcon ? emojiIcon[0] : '', '').trim() : c.name}
-
+
{new Date(c.lastModifiedDateTime).toLocaleString('en-US', { year: 'numeric', month: '2-digit', @@ -96,7 +93,9 @@ const FileListItem: FunctionComponent<{ hour12: false, })}
-
{humanFileSize(c.size)}
+
+ {humanFileSize(c.size)} +
) } @@ -116,14 +115,14 @@ const FileListing: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) = if (error) { return ( -
+
) } if (!data) { return ( -
+
) @@ -170,8 +169,8 @@ const FileListing: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) = }) return ( -
-
+
+
Name
Last Modified
Size
@@ -234,7 +233,7 @@ const FileListing: FunctionComponent<{ query?: ParsedUrlQuery }> = ({ query }) = ))} {renderReadme && ( -
+
)} diff --git a/components/Loading.tsx b/components/Loading.tsx index d62ae2b..087ab78 100644 --- a/components/Loading.tsx +++ b/components/Loading.tsx @@ -2,7 +2,7 @@ import { FunctionComponent } from 'react' const Loading: FunctionComponent<{ loadingText: string }> = ({ loadingText }) => { return ( -
+
{ return ( -
+
-

{siteConfig.title}

- +

{siteConfig.title}

+
diff --git a/components/previews/AudioPreview.tsx b/components/previews/AudioPreview.tsx index f668726..0dfe048 100644 --- a/components/previews/AudioPreview.tsx +++ b/components/previews/AudioPreview.tsx @@ -16,9 +16,9 @@ export const AudioPreview: FunctionComponent<{ file: any }> = ({ file }) => { return ( <> -
+
-
+
{playerStatus === PlayerState.Loading ? (
= ({ file }) => { if (error) { return ( -
+
) } if (!data) { return ( -
+
) @@ -35,7 +35,7 @@ const CodePreview: FunctionComponent<{ file: any }> = ({ file }) => { return ( <> -
+
           {data}
         
diff --git a/components/previews/MarkdownPreview.tsx b/components/previews/MarkdownPreview.tsx index cea8e77..3fa4e09 100644 --- a/components/previews/MarkdownPreview.tsx +++ b/components/previews/MarkdownPreview.tsx @@ -9,7 +9,6 @@ import rehypeKatex from 'rehype-katex' import rehypeRaw from 'rehype-raw' import 'katex/dist/katex.min.css' -import 'github-markdown-css/github-markdown.css' import FourOhFour from '../FourOhFour' import Loading from '../Loading' @@ -18,7 +17,15 @@ import DownloadBtn from '../DownloadBtn' const fetcher = (url: string) => axios.get(url).then(res => res.data) const MarkdownPreview: FunctionComponent<{ file: any; standalone?: boolean }> = ({ file, standalone = true }) => { - const { data, error } = useSWR(file['@microsoft.graph.downloadUrl'], fetcher) + const { data, error } = useSWR(file['@microsoft.graph.downloadUrl'], fetcher, { + revalidateOnFocus: false, + revalidateOnMount: false, + revalidateOnReconnect: false, + refreshWhenOffline: false, + refreshWhenHidden: false, + refreshInterval: 0, + }) + useEffect(() => { if (typeof window !== 'undefined') { Prism.highlightAll() @@ -27,14 +34,14 @@ const MarkdownPreview: FunctionComponent<{ file: any; standalone?: boolean }> = if (error) { return ( -
+
) } if (!data) { return ( -
+
) @@ -42,7 +49,13 @@ const MarkdownPreview: FunctionComponent<{ file: any; standalone?: boolean }> = return ( <> -
+
{/* Using rehypeRaw to render HTML inside Markdown, is potentially dangerous, use under safe environments. (#18) */} {data} diff --git a/components/previews/PDFPreview.tsx b/components/previews/PDFPreview.tsx index 8ed1274..8148fb6 100644 --- a/components/previews/PDFPreview.tsx +++ b/components/previews/PDFPreview.tsx @@ -26,12 +26,12 @@ const PDFPreview: FunctionComponent<{ file: any }> = ({ file }) => { return ( <>
} @@ -46,7 +46,7 @@ const PDFPreview: FunctionComponent<{ file: any }> = ({ file }) => {
-
+