From e01367e5f2fead9946e13dd5b08bec848c218813 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 13:58:48 +0100 Subject: [PATCH 01/24] feat: add folder size --- core/Cargo.lock | 7 +++++++ core/Cargo.toml | 1 + core/src/fs/file.rs | 5 ++++- core/tauri.conf.json | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/Cargo.lock b/core/Cargo.lock index 9f9d7941..bd68b43b 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -917,6 +917,7 @@ dependencies = [ "chrono", "dirs", "filesize", + "fs_extra", "futures", "hyper", "lazy_static", @@ -1038,6 +1039,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futf" version = "0.1.5" diff --git a/core/Cargo.toml b/core/Cargo.toml index 7352e20c..5f26c99e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -52,6 +52,7 @@ ts-rs = "7.0.0" pnet = "0.34.0" open = "5.1.2" path-absolutize = "3.1.1" +fs_extra = "1.3.0" [features] # this feature is used for production builds or when `devPath` points to the filesystem # DO NOT REMOVE!! diff --git a/core/src/fs/file.rs b/core/src/fs/file.rs index a830734d..00606f32 100644 --- a/core/src/fs/file.rs +++ b/core/src/fs/file.rs @@ -48,7 +48,7 @@ impl File { pub fn from_path(path: &PathBuf) -> Self { let file_name = path.file_name().unwrap().to_str().unwrap(); let file_path = path.display().to_string(); - let file_size: u128 = path.size_on_disk().unwrap_or(0).into(); + let mut file_size: u128 = path.size_on_disk().unwrap_or(0).into(); let file_format = path .extension() .unwrap_or_default() @@ -57,6 +57,9 @@ impl File { let is_folder = path.is_dir(); + if is_folder { + file_size = fs_extra::dir::get_size(path).unwrap_or(0) as u128; + } let is_hidden = path .file_name() .unwrap() diff --git a/core/tauri.conf.json b/core/tauri.conf.json index 8aadff1e..6c12cc54 100644 --- a/core/tauri.conf.json +++ b/core/tauri.conf.json @@ -77,7 +77,9 @@ "width": 1000, "height": 800, "fileDropEnabled": true + } + ] } } From 8058865fdbacd90bb9b8c4ade0ff32915258c88e Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 14:57:59 +0100 Subject: [PATCH 02/24] feat: imple view renderer --- Makefile | 22 ++++--- core/src/api/fs.rs | 2 +- core/tauri.conf copy.json | 97 ++++++++++++++++++++++++++++++ core/tauri.conf.json | 3 +- package.json | 3 +- render/index.html | 11 ---- {render => renderer}/css/style.css | 0 renderer/index.html | 21 +++++++ {render => renderer}/js/app.js | 0 {render => renderer}/js/audio.js | 0 {render => renderer}/js/image.js | 0 {render => renderer}/js/pdf.js | 0 {render => renderer}/js/video.js | 0 scripts/copy_renderer_files | 4 ++ src/components/thumbnail/index.tsx | 58 ++++++++++++------ src/pages/[...slug].tsx | 58 ++++++++++++++++++ 16 files changed, 236 insertions(+), 43 deletions(-) create mode 100644 core/tauri.conf copy.json delete mode 100644 render/index.html rename {render => renderer}/css/style.css (100%) create mode 100644 renderer/index.html rename {render => renderer}/js/app.js (100%) rename {render => renderer}/js/audio.js (100%) rename {render => renderer}/js/image.js (100%) rename {render => renderer}/js/pdf.js (100%) rename {render => renderer}/js/video.js (100%) create mode 100644 scripts/copy_renderer_files create mode 100644 src/pages/[...slug].tsx diff --git a/Makefile b/Makefile index c9e1eef3..f2e45e49 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ install-toolchain: - - -install: - - - -run: - - -build: \ No newline at end of file + npm install -g yarn + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +#install the system depencies +install-deps: + yarn install + cd core && cargo build +# run the dev server +dev: + yarn tauri dev +# build the binary for the current OS +build: + yarn tauri build \ No newline at end of file diff --git a/core/src/api/fs.rs b/core/src/api/fs.rs index f6771685..6727346f 100644 --- a/core/src/api/fs.rs +++ b/core/src/api/fs.rs @@ -11,7 +11,7 @@ use serde_json::{json, Value}; use ts_rs::TS; use crate::database::{self, TransferHistory, TransferHistoryBuilder}; -use crate::fs::search::search_files; +// use crate::fs::search::search_files; use crate::wifi::ip_manager; use tokio::io::AsyncReadExt; diff --git a/core/tauri.conf copy.json b/core/tauri.conf copy.json new file mode 100644 index 00000000..f1aba950 --- /dev/null +++ b/core/tauri.conf copy.json @@ -0,0 +1,97 @@ +{ + "build": { + "beforeDevCommand": "yarn dev", + "beforeBuildCommand": "yarn build && yarn export ", + "devPath": "http://localhost:1420", + "distDir": "../out", + "withGlobalTauri": true + }, + "package": { + "productName": "filesync", + "version": "0.6.3" + }, + "tauri": { + "allowlist": { + "all": false, + "app": { + "all": true, + "hide": true, + "show": true + }, + "dialog": { + "all": true, + "open": true, + "save": true + }, + "fs": { + "all": true, + "readFile": true, + "writeFile": true, + "readDir": true, + "copyFile": true, + "createDir": true, + "renameFile": true, + "removeFile": true, + "removeDir": true, + "exists": true, + "scope": [ + "$AUDIO", + "$VIDEO", + "$PICTURE", + "$DESKTOP", + "$DOWNLOAD", + "$DOCUMENT" + ] + }, + "path": { + "all": true + }, + "shell": { + "all": false, + "open": true + } + }, + "bundle": { + "active": true, + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ], + "identifier": "com.filesync.app", + "targets": "all" + }, + "security": { + "csp": null + }, + "updater": { + "active": false + }, + "windows": [ + { + "fullscreen": false, + "resizable": false, + "title": "FileSync", + "width": 1000, + "height": 800, + "fileDropEnabled": true + + }, + { + "fullscreen": false, + "resizable": true, + "title": "file_renderer", + "titleBarStyle": "Overlay", + "center": true, + "alwaysOnTop": true, + "closable": true, + "decorations": true, + "label": "Preview", + "additionalBrowserArgs": "fileType", + "url": "../out/media_renderer/index.html" + } + ] + } +} diff --git a/core/tauri.conf.json b/core/tauri.conf.json index 6c12cc54..3a42d511 100644 --- a/core/tauri.conf.json +++ b/core/tauri.conf.json @@ -77,9 +77,8 @@ "width": 1000, "height": 800, "fileDropEnabled": true - + } - ] } } diff --git a/package.json b/package.json index 5bd041c0..7b13f031 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "export": "next export", "start": "next start", "tauri": "tauri", - "lint": "next lint" + "lint": "next lint", + "postbuild":"sh ./scripts/copy_renderer_files" }, "dependencies": { "@headlessui/react": "^1.7.13", diff --git a/render/index.html b/render/index.html deleted file mode 100644 index 109a17b0..00000000 --- a/render/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Assets Renderer - - - - - \ No newline at end of file diff --git a/render/css/style.css b/renderer/css/style.css similarity index 100% rename from render/css/style.css rename to renderer/css/style.css diff --git a/renderer/index.html b/renderer/index.html new file mode 100644 index 00000000..cd114f9e --- /dev/null +++ b/renderer/index.html @@ -0,0 +1,21 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/render/js/app.js b/renderer/js/app.js similarity index 100% rename from render/js/app.js rename to renderer/js/app.js diff --git a/render/js/audio.js b/renderer/js/audio.js similarity index 100% rename from render/js/audio.js rename to renderer/js/audio.js diff --git a/render/js/image.js b/renderer/js/image.js similarity index 100% rename from render/js/image.js rename to renderer/js/image.js diff --git a/render/js/pdf.js b/renderer/js/pdf.js similarity index 100% rename from render/js/pdf.js rename to renderer/js/pdf.js diff --git a/render/js/video.js b/renderer/js/video.js similarity index 100% rename from render/js/video.js rename to renderer/js/video.js diff --git a/scripts/copy_renderer_files b/scripts/copy_renderer_files new file mode 100644 index 00000000..fba30c1d --- /dev/null +++ b/scripts/copy_renderer_files @@ -0,0 +1,4 @@ +#!bin/bash + + +cp -r renderer ./out/media_renderer \ No newline at end of file diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index ff6845c6..a1614cb9 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -14,11 +14,12 @@ import svgIcon from "@/assets/common/svg.png"; import Image, { StaticImageData } from "next/image"; import folderIcon from "@/assets/common/folder-icon.png"; import { File } from "../../../core/bindings/File"; - +import { WebviewWindow } from "@tauri-apps/api/window"; +import { useRouter } from "next/router"; +import Link from "next/link"; // to interface with audio files coming from the application core // the type extends the AppData type -export interface FileInterface extends File { -} +export interface FileInterface extends File {} // the required data to render the file card component export interface FileCardInterface extends FileInterface { @@ -42,21 +43,45 @@ export interface FileTransferInterface { status: FileTransferStatus; } -interface Props extends FileCardInterface { -} +interface Props extends FileCardInterface {} -export default function FileCard( - { fileName, fileFormat, filePath, fileSize, action, isFolder, isHidden }: Props, -) { - let thumbnail: StaticImageData ; +export default function FileCard({ + fileName, + fileFormat, + filePath, + fileSize, + // action, + isFolder, + isHidden, +}: Props) { + // a webview to render media files + const webview = new WebviewWindow("media_renderer", { + url: "out/media_renderer/index.html", + }); + + webview.once("tauri://created", function () { + // webview window successfully created + window.alert("hey! into renderer"); + }); + + let thumbnail: StaticImageData; if (isFolder) { thumbnail = folderIcon; } else { thumbnail = getFileIcon(fileFormat); } + + // if it is a folder open in folder renderer + // otherwise open in file renderer + let path; + if (isFolder) { + path =`/render?filePath=${filePath}&fileType=${fileFormat}&isFolder=${isFolder}`; + } else { + path = `/render?filePath=${filePath}&fileType=${fileFormat}&isFolder=${isFolder}`; + } + return ( -
@@ -74,16 +99,15 @@ export default function FileCard(
{fileName}
- +
- {computeFileSize(fileSize as unknown as number)}{" "} - {/**file duration goes here */} + {computeFileSize(fileSize as unknown as number)}
-
+ ); } @@ -304,9 +328,7 @@ export function getFileIcon(fileExtension: string) { return pdfIcon; } else if (csvExtensions.includes(extension)) { return csvIcon; - } else if ( - presentationExtensions.includes(extension) - ) { + } else if (presentationExtensions.includes(extension)) { return presentationIcon; } else if (videoExtensions.includes(extension)) { return videoIcon; diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx new file mode 100644 index 00000000..0820b3e2 --- /dev/null +++ b/src/pages/[...slug].tsx @@ -0,0 +1,58 @@ +"use client"; + +import { useRouter } from "next/router"; +import { useEffect, useState } from "react"; +import { useSearchParams } from "next/navigation"; +import { FileInterface } from "@/components/thumbnail"; +import { AppData } from "@/types"; +import { invoke } from "@tauri-apps/api"; +import LoaderCircle from "@/components/loaders/LoaderCircle"; + +export default function PreviewMediaPage() { + const router = useRouter(); + const searchParams = useSearchParams(); + const filePath = searchParams.get("filePath"); + const isFolder = searchParams.get("isFolder"); + const fileType = searchParams.get("fileType"); + + const [data, setData] = useState(null); + const [isLoading, setLoading] = useState(false); + + // get the data from the application core + useEffect(() => { + setLoading(true); + invoke("read_dir", { path: "documents" }).then((res) => { + setData(res as any); + setLoading(false); + }); + }, []); + + // typecast the response into AppData type + const fetchedDocuments = data as unknown as AppData>; + if (isLoading) { + return ( + <> + +

Loading...

+

+ Please wait while we load your documents. This might take a while. +

+ + ); + } + + + return ( +
+

file path: {filePath}

+

file type {fileType}

+

+ is folder {isFolder} +

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellat iste + sequi aliquam aliquid! Iusto doloribus veritatis facere aliquam mollitia + consequuntur hic, nostrum, fugiat pariatur incidunt, modi voluptatum illo + doloremque maxime? +
+ ); +} From 1edea3835e729fab75809875b2a3483f685f446c Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 15:07:26 +0100 Subject: [PATCH 03/24] feat: add folder renderer component --- src/pages/[...slug].tsx | 98 ++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index 0820b3e2..bb71748d 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -3,10 +3,12 @@ import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { useSearchParams } from "next/navigation"; -import { FileInterface } from "@/components/thumbnail"; +import FileCard, { FileInterface } from "@/components/thumbnail"; import { AppData } from "@/types"; import { invoke } from "@tauri-apps/api"; import LoaderCircle from "@/components/loaders/LoaderCircle"; +import QuickAccessLayout from "@/components/layout/PageLayout"; +import { shareFile } from "@/utils"; export default function PreviewMediaPage() { const router = useRouter(); @@ -15,40 +17,74 @@ export default function PreviewMediaPage() { const isFolder = searchParams.get("isFolder"); const fileType = searchParams.get("fileType"); - const [data, setData] = useState(null); - const [isLoading, setLoading] = useState(false); - - // get the data from the application core - useEffect(() => { - setLoading(true); - invoke("read_dir", { path: "documents" }).then((res) => { - setData(res as any); - setLoading(false); - }); - }, []); - - // typecast the response into AppData type - const fetchedDocuments = data as unknown as AppData>; - if (isLoading) { - return ( - <> - -

Loading...

-

- Please wait while we load your documents. This might take a while. -

- - ); - } - - + // if it is a folder, get the files nd list them + if (isFolder) { + // eslint-disable-next-line react-hooks/rules-of-hooks + const [data, setData] = useState(null); + // eslint-disable-next-line react-hooks/rules-of-hooks + const [isLoading, setLoading] = useState(false); + + // get the data from the application core + // eslint-disable-next-line react-hooks/rules-of-hooks + useEffect(() => { + setLoading(true); + invoke("read_dir", { path: filePath?.trim() }).then((res) => { + setData(res as any); + setLoading(false); + }); + }, []); + + // typecast the response into AppData type + const fetchedFiles = data as unknown as AppData>; + if (isLoading) { + return ( + <> + +

Loading...

+

+ Please wait while we load your documents. This might take a while. +

+ + ); + } + + + // render them + return ( + +
+
+ {fetchedFiles?.data.map((file, index) => ( + shareFile(file.filePath)} + isHidden={file.isHidden} + isFolder={file.isFolder} + /> + ))} +
+
+
+ ); + } + + + if (isFolder) { + return; + } return (

file path: {filePath}

file type {fileType}

-

- is folder {isFolder} -

+

is folder {isFolder}

Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellat iste sequi aliquam aliquid! Iusto doloribus veritatis facere aliquam mollitia consequuntur hic, nostrum, fugiat pariatur incidunt, modi voluptatum illo From 2aae8e9b4b74028fabb39d35f97c7b377c478c37 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 16:24:38 +0100 Subject: [PATCH 04/24] refactor --- core/Cargo.toml | 2 +- core/tauri.conf.json | 5 +- src/components/thumbnail/index.tsx | 17 +--- src/pages/[...slug].tsx | 152 +++++++++++++++++------------ 4 files changed, 99 insertions(+), 77 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index 5f26c99e..8773725b 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -37,7 +37,7 @@ serde_json = "1.0" sqlx = {version = "0.6.2", features = ["sqlite", "runtime-tokio-native-tls"] } sys-info = "0.9.1" sysinfo = "0.29.2" -tauri = {version = "1.2", features = ["app-all", "dialog-all", "fs-all", "path-all", "shell-open"] } +tauri = {version = "1.2", features = [ "window-all", "app-all", "dialog-all", "fs-all", "path-all", "shell-open"] } tokio = {version = "1.26.0", features = ["full"] } tokio-util = {version = "0.7", features = ["io"] } tower = {version = "0.4", features = ["util"] } diff --git a/core/tauri.conf.json b/core/tauri.conf.json index 3a42d511..d7373a39 100644 --- a/core/tauri.conf.json +++ b/core/tauri.conf.json @@ -13,6 +13,10 @@ "tauri": { "allowlist": { "all": false, + "window": { + "all": true + + }, "app": { "all": true, "hide": true, @@ -77,7 +81,6 @@ "width": 1000, "height": 800, "fileDropEnabled": true - } ] } diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index a1614cb9..b81fe8e9 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -1,3 +1,5 @@ +"use client"; + import { FileTransferStatus } from "@/store/context"; import { computeFileSize, isClient } from "@/utils"; import imageIcon from "@/assets/common/image.png"; @@ -54,16 +56,6 @@ export default function FileCard({ isFolder, isHidden, }: Props) { - // a webview to render media files - const webview = new WebviewWindow("media_renderer", { - url: "out/media_renderer/index.html", - }); - - webview.once("tauri://created", function () { - // webview window successfully created - window.alert("hey! into renderer"); - }); - let thumbnail: StaticImageData; if (isFolder) { thumbnail = folderIcon; @@ -75,13 +67,14 @@ export default function FileCard({ // otherwise open in file renderer let path; if (isFolder) { - path =`/render?filePath=${filePath}&fileType=${fileFormat}&isFolder=${isFolder}`; + path = `/render?filePath=${filePath}&fileType=${fileFormat}&isFolder=${isFolder}`; } else { path = `/render?filePath=${filePath}&fileType=${fileFormat}&isFolder=${isFolder}`; } return ( -
diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index bb71748d..619763ed 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -8,87 +8,113 @@ import { AppData } from "@/types"; import { invoke } from "@tauri-apps/api"; import LoaderCircle from "@/components/loaders/LoaderCircle"; import QuickAccessLayout from "@/components/layout/PageLayout"; -import { shareFile } from "@/utils"; +import { WebviewWindow } from "@tauri-apps/api/window"; export default function PreviewMediaPage() { + const [data, setData] = useState(null); + const [isLoading, setLoading] = useState(false); + const router = useRouter(); const searchParams = useSearchParams(); const filePath = searchParams.get("filePath"); const isFolder = searchParams.get("isFolder"); const fileType = searchParams.get("fileType"); - // if it is a folder, get the files nd list them - if (isFolder) { - // eslint-disable-next-line react-hooks/rules-of-hooks - const [data, setData] = useState(null); - // eslint-disable-next-line react-hooks/rules-of-hooks - const [isLoading, setLoading] = useState(false); + const createWebView = () => { + // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it + const webview = new WebviewWindow("render_media", { + url: "https://google.com", + }); + + webview.once("tauri://created", function () { + // webview window successfully created + }); + + webview.once("tauri://error", function (e) { + // an error happened creating the webview window + console.log("an error occured while opening the window due to ", e); + }); + + // console.log("window successfully created"); + // webview.setAlwaysOnTop(true); + // webview.center(); + // webview.requestUserAttention; + // webview.isDecorated(); + // webview.setFocus(); + }; - // get the data from the application core - // eslint-disable-next-line react-hooks/rules-of-hooks - useEffect(() => { + const openInWebView = (filePath: string|null) => { + console.log({ filePath }); + }; + + useEffect(() => { + if (isFolder) { setLoading(true); invoke("read_dir", { path: filePath?.trim() }).then((res) => { setData(res as any); setLoading(false); }); - }, []); - - // typecast the response into AppData type - const fetchedFiles = data as unknown as AppData>; - if (isLoading) { - return ( - <> - -

Loading...

-

- Please wait while we load your documents. This might take a while. -

- - ); - } + } else { + setLoading(false); + setData(null); + } + }, [filePath, isFolder]); + // typecast the response into AppData type + const fetchedFiles = data as unknown as AppData>; - // render them - return ( - -
-
- {fetchedFiles?.data.map((file, index) => ( - shareFile(file.filePath)} - isHidden={file.isHidden} - isFolder={file.isFolder} - /> - ))} -
-
-
- ); + // if it is a folder, get the files nd list them + // get the data from the application core + if (isLoading) { + return ( + <> + +

Loading...

+

+ Please wait while we load your documents. This might take a while. +

+ + ); } + // render them + if (data) { + return ( + +
+
+ {fetchedFiles?.data.map((file, index) => ( + + ))} +
+
+
+ ); + } else { + createWebView(); + openInWebView(filePath); - if (isFolder) { - return; + return ( + <> +
+ Lorem ipsum dolor sit amet consectetur, adipisicing elit. Impedit + repudiandae deleniti, molestiae architecto dolore earum asperiores + labore, ut blanditiis doloremque eaque cum natus nulla nemo officia + perspiciatis deserunt? Facilis, maiores! +
+ + ); } - return ( -
-

file path: {filePath}

-

file type {fileType}

-

is folder {isFolder}

- Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellat iste - sequi aliquam aliquid! Iusto doloribus veritatis facere aliquam mollitia - consequuntur hic, nostrum, fugiat pariatur incidunt, modi voluptatum illo - doloremque maxime? -
- ); } From 939b645172c9220f0893c86c7139188445873708 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 18:05:24 +0100 Subject: [PATCH 05/24] feat: create dynamic window --- core/tauri.conf copy.json | 130 ++++++++--------------------- core/tauri.conf.json | 5 +- src/components/thumbnail/index.tsx | 47 +++++++++-- src/pages/[...slug].tsx | 69 +++++++-------- src/styles/globals.css | 3 + 5 files changed, 111 insertions(+), 143 deletions(-) diff --git a/core/tauri.conf copy.json b/core/tauri.conf copy.json index f1aba950..9e39dfd3 100644 --- a/core/tauri.conf copy.json +++ b/core/tauri.conf copy.json @@ -1,97 +1,33 @@ -{ - "build": { - "beforeDevCommand": "yarn dev", - "beforeBuildCommand": "yarn build && yarn export ", - "devPath": "http://localhost:1420", - "distDir": "../out", - "withGlobalTauri": true - }, - "package": { - "productName": "filesync", - "version": "0.6.3" - }, - "tauri": { - "allowlist": { - "all": false, - "app": { - "all": true, - "hide": true, - "show": true - }, - "dialog": { - "all": true, - "open": true, - "save": true - }, - "fs": { - "all": true, - "readFile": true, - "writeFile": true, - "readDir": true, - "copyFile": true, - "createDir": true, - "renameFile": true, - "removeFile": true, - "removeDir": true, - "exists": true, - "scope": [ - "$AUDIO", - "$VIDEO", - "$PICTURE", - "$DESKTOP", - "$DOWNLOAD", - "$DOCUMENT" - ] - }, - "path": { - "all": true - }, - "shell": { - "all": false, - "open": true - } - }, - "bundle": { - "active": true, - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.icns", - "icons/icon.ico" - ], - "identifier": "com.filesync.app", - "targets": "all" - }, - "security": { - "csp": null - }, - "updater": { - "active": false - }, - "windows": [ - { - "fullscreen": false, - "resizable": false, - "title": "FileSync", - "width": 1000, - "height": 800, - "fileDropEnabled": true - - }, - { - "fullscreen": false, - "resizable": true, - "title": "file_renderer", - "titleBarStyle": "Overlay", - "center": true, - "alwaysOnTop": true, - "closable": true, - "decorations": true, - "label": "Preview", - "additionalBrowserArgs": "fileType", - "url": "../out/media_renderer/index.html" - } - ] - } -} +"center": false, + "close": false, + "create": false, + "hide": false, + "maximize": false, + "minimize": false, + "print": false, + "requestUserAttention": false, + "setAlwaysOnTop": false, + "setClosable": false, + "setContentProtected": false, + "setCursorGrab": false, + "setCursorIcon": false, + "setCursorPosition": false, + "setCursorVisible": false, + "setDecorations": false, + "setFocus": false, + "setFullscreen": false, + "setIcon": false, + "setIgnoreCursorEvents": false, + "setMaxSize": false, + "setMaximizable": false, + "setMinSize": false, + "setMinimizable": false, + "setPosition": false, + "setResizable": false, + "setSize": false, + "setSkipTaskbar": false, + "setTitle": false, + "show": false, + "startDragging": false, + "unmaximize": false, + "unminimize": false \ No newline at end of file diff --git a/core/tauri.conf.json b/core/tauri.conf.json index d7373a39..70b89c12 100644 --- a/core/tauri.conf.json +++ b/core/tauri.conf.json @@ -13,10 +13,9 @@ "tauri": { "allowlist": { "all": false, - "window": { + "window": { "all": true - - }, + }, "app": { "all": true, "hide": true, diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index b81fe8e9..81a9939c 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -1,7 +1,7 @@ "use client"; import { FileTransferStatus } from "@/store/context"; -import { computeFileSize, isClient } from "@/utils"; +import { computeFileSize } from "@/utils"; import imageIcon from "@/assets/common/image.png"; import audioIcon from "@/assets/common/audio.png"; import presentationIcon from "@/assets/common/presentation.png"; @@ -19,6 +19,33 @@ import { File } from "../../../core/bindings/File"; import { WebviewWindow } from "@tauri-apps/api/window"; import { useRouter } from "next/router"; import Link from "next/link"; + +const createWebView = () => { + // if the window already exist close it + + // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it + const webview = new WebviewWindow("default-" + new Date().getTime(), { + // url: "../out/media_renderer/index.html", + url: "https://google.com", + // resizable: false, + // alwaysOnTop: true, + // focus: true, + // minimizable: false, + // center: true, + // skipTaskbar: true, + }); + + webview.once("tauri://created", function () { + // webview window successfully created + console.log("window created successfully"); + }); + + webview.once("tauri://error", function (e) { + // an error happened creating the webview window + console.log("an error occured while opening the window due to ", e); + }); +}; + // to interface with audio files coming from the application core // the type extends the AppData type export interface FileInterface extends File {} @@ -63,6 +90,8 @@ export default function FileCard({ thumbnail = getFileIcon(fileFormat); } + const router = useRouter(); + // if it is a folder open in folder renderer // otherwise open in file renderer let path; @@ -73,8 +102,12 @@ export default function FileCard({ } return ( - { + // isFolder ? router.push(path): createWebView; + // }} + onClick={createWebView} className="flex w-full hover:shadow hover:rounded-lg rouned bg-[#f9fbfe] flex-wrap items-center gap-2 cursor-pointer px-4 py-2 last:mb-10 " >
@@ -89,7 +122,7 @@ export default function FileCard({ }
-
+
{fileName}
@@ -97,10 +130,12 @@ export default function FileCard({ className="flex gap-3 mt[1.5px] text-gray-600 text-xs height={30} // Desired size with correct aspect ratio width={30} " > - {computeFileSize(fileSize as unknown as number)} + + {computeFileSize(fileSize as unknown as number)} +
- +
); } diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index 619763ed..886e071f 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -10,6 +10,31 @@ import LoaderCircle from "@/components/loaders/LoaderCircle"; import QuickAccessLayout from "@/components/layout/PageLayout"; import { WebviewWindow } from "@tauri-apps/api/window"; + + + const createWebView = () => { + // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it + const webview = new WebviewWindow("google", { + url: "https://google.com", + }); + + webview.once("tauri://created", function () { + // webview window successfully created + }); + + webview.once("tauri://error", function (e) { + // an error happened creating the webview window + console.log("an error occured while opening the window due to ", e); + }); + + // console.log("window successfully created"); + // webview.setAlwaysOnTop(true); + // webview.center(); + // webview.requestUserAttention; + // webview.isDecorated(); + // webview.setFocus(); + }; + export default function PreviewMediaPage() { const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); @@ -20,28 +45,7 @@ export default function PreviewMediaPage() { const isFolder = searchParams.get("isFolder"); const fileType = searchParams.get("fileType"); - const createWebView = () => { - // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it - const webview = new WebviewWindow("render_media", { - url: "https://google.com", - }); - - webview.once("tauri://created", function () { - // webview window successfully created - }); - - webview.once("tauri://error", function (e) { - // an error happened creating the webview window - console.log("an error occured while opening the window due to ", e); - }); - - // console.log("window successfully created"); - // webview.setAlwaysOnTop(true); - // webview.center(); - // webview.requestUserAttention; - // webview.isDecorated(); - // webview.setFocus(); - }; + const openInWebView = (filePath: string|null) => { console.log({ filePath }); @@ -77,6 +81,11 @@ export default function PreviewMediaPage() { ); } + + if (!isFolder){ + createWebView(); + return + } // render them if (data) { return ( @@ -102,19 +111,5 @@ export default function PreviewMediaPage() { ); - } else { - createWebView(); - openInWebView(filePath); - - return ( - <> -
- Lorem ipsum dolor sit amet consectetur, adipisicing elit. Impedit - repudiandae deleniti, molestiae architecto dolore earum asperiores - labore, ut blanditiis doloremque eaque cum natus nulla nemo officia - perspiciatis deserunt? Facilis, maiores! -
- - ); - } + } } diff --git a/src/styles/globals.css b/src/styles/globals.css index 72099f2c..7035eec3 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -2,6 +2,9 @@ @tailwind components; @tailwind utilities; +*{ + user-select: none!important; +} #layout>aside, #layout>main { From f1714356594e16a908167256ba67eeb1ebfbc607 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 18:05:48 +0100 Subject: [PATCH 06/24] refactor --- core/tauri.conf copy.json | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 core/tauri.conf copy.json diff --git a/core/tauri.conf copy.json b/core/tauri.conf copy.json deleted file mode 100644 index 9e39dfd3..00000000 --- a/core/tauri.conf copy.json +++ /dev/null @@ -1,33 +0,0 @@ -"center": false, - "close": false, - "create": false, - "hide": false, - "maximize": false, - "minimize": false, - "print": false, - "requestUserAttention": false, - "setAlwaysOnTop": false, - "setClosable": false, - "setContentProtected": false, - "setCursorGrab": false, - "setCursorIcon": false, - "setCursorPosition": false, - "setCursorVisible": false, - "setDecorations": false, - "setFocus": false, - "setFullscreen": false, - "setIcon": false, - "setIgnoreCursorEvents": false, - "setMaxSize": false, - "setMaximizable": false, - "setMinSize": false, - "setMinimizable": false, - "setPosition": false, - "setResizable": false, - "setSize": false, - "setSkipTaskbar": false, - "setTitle": false, - "show": false, - "startDragging": false, - "unmaximize": false, - "unminimize": false \ No newline at end of file From 3afc2db5bd8361f3dfb1f828fbe3f7edcd9644f3 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 18:12:05 +0100 Subject: [PATCH 07/24] fixes --- src/components/thumbnail/index.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index 81a9939c..514ef760 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -24,11 +24,11 @@ const createWebView = () => { // if the window already exist close it // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it - const webview = new WebviewWindow("default-" + new Date().getTime(), { - // url: "../out/media_renderer/index.html", - url: "https://google.com", - // resizable: false, - // alwaysOnTop: true, + const webview = new WebviewWindow("default", { + url: "../out/media_renderer/index.html", + // url: "https://google.com", + resizable: false, + alwaysOnTop: true, // focus: true, // minimizable: false, // center: true, @@ -44,6 +44,13 @@ const createWebView = () => { // an error happened creating the webview window console.log("an error occured while opening the window due to ", e); }); + + console.log("window successfully created"); + webview.setAlwaysOnTop(true); + webview.center(); + webview.requestUserAttention; + webview.isDecorated(); + webview.setFocus(); }; // to interface with audio files coming from the application core From d62eadaa93e990a79fe77735e54b34ffc78ff5a4 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 18:15:41 +0100 Subject: [PATCH 08/24] fixes: try fixing renderer not showing --- src/components/thumbnail/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index 514ef760..3c50c453 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -25,7 +25,7 @@ const createWebView = () => { // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it const webview = new WebviewWindow("default", { - url: "../out/media_renderer/index.html", + url: "../../../out/media_renderer/index.html", // url: "https://google.com", resizable: false, alwaysOnTop: true, From 5e20ac6599d722a48ec82f460c64853e7d8db4c9 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Mon, 8 Apr 2024 23:11:47 +0100 Subject: [PATCH 09/24] refactor: use modal in place of a new window --- public/renderer.html | 13 ++ {renderer => public/renderer}/css/style.css | 0 {renderer => public/renderer}/index.html | 0 {renderer => public/renderer}/js/app.js | 0 {renderer => public/renderer}/js/audio.js | 0 {renderer => public/renderer}/js/image.js | 0 {renderer => public/renderer}/js/pdf.js | 0 {renderer => public/renderer}/js/video.js | 0 src/components/thumbnail/index.tsx | 183 ++++++++++---------- tsconfig.json | 1 + 10 files changed, 109 insertions(+), 88 deletions(-) create mode 100644 public/renderer.html rename {renderer => public/renderer}/css/style.css (100%) rename {renderer => public/renderer}/index.html (100%) rename {renderer => public/renderer}/js/app.js (100%) rename {renderer => public/renderer}/js/audio.js (100%) rename {renderer => public/renderer}/js/image.js (100%) rename {renderer => public/renderer}/js/pdf.js (100%) rename {renderer => public/renderer}/js/video.js (100%) diff --git a/public/renderer.html b/public/renderer.html new file mode 100644 index 00000000..b2fe7209 --- /dev/null +++ b/public/renderer.html @@ -0,0 +1,13 @@ + + + + + + Document + + +

+ render here +

+ + \ No newline at end of file diff --git a/renderer/css/style.css b/public/renderer/css/style.css similarity index 100% rename from renderer/css/style.css rename to public/renderer/css/style.css diff --git a/renderer/index.html b/public/renderer/index.html similarity index 100% rename from renderer/index.html rename to public/renderer/index.html diff --git a/renderer/js/app.js b/public/renderer/js/app.js similarity index 100% rename from renderer/js/app.js rename to public/renderer/js/app.js diff --git a/renderer/js/audio.js b/public/renderer/js/audio.js similarity index 100% rename from renderer/js/audio.js rename to public/renderer/js/audio.js diff --git a/renderer/js/image.js b/public/renderer/js/image.js similarity index 100% rename from renderer/js/image.js rename to public/renderer/js/image.js diff --git a/renderer/js/pdf.js b/public/renderer/js/pdf.js similarity index 100% rename from renderer/js/pdf.js rename to public/renderer/js/pdf.js diff --git a/renderer/js/video.js b/public/renderer/js/video.js similarity index 100% rename from renderer/js/video.js rename to public/renderer/js/video.js diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index 3c50c453..3e7dafbb 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -1,57 +1,24 @@ "use client"; -import { FileTransferStatus } from "@/store/context"; -import { computeFileSize } from "@/utils"; -import imageIcon from "@/assets/common/image.png"; +import archiveIcon from "@/assets/common/archived.png"; import audioIcon from "@/assets/common/audio.png"; -import presentationIcon from "@/assets/common/presentation.png"; -import pdfIcon from "@/assets/common/pdf.png"; -import videoIcon from "@/assets/common/video.png"; import csvIcon from "@/assets/common/csv.png"; import defaultIcon from "@/assets/common/default.png"; -import archiveIcon from "@/assets/common/archived.png"; import documentIcon from "@/assets/common/document.png"; -import textIcon from "@/assets/common/text.png"; +import folderIcon from "@/assets/common/folder-icon.png"; +import imageIcon from "@/assets/common/image.png"; +import pdfIcon from "@/assets/common/pdf.png"; +import presentationIcon from "@/assets/common/presentation.png"; import svgIcon from "@/assets/common/svg.png"; +import textIcon from "@/assets/common/text.png"; +import videoIcon from "@/assets/common/video.png"; +import { FileTransferStatus } from "@/store/context"; +import { computeFileSize } from "@/utils"; +import Modal from "antd/es/modal/Modal"; import Image, { StaticImageData } from "next/image"; -import folderIcon from "@/assets/common/folder-icon.png"; -import { File } from "../../../core/bindings/File"; -import { WebviewWindow } from "@tauri-apps/api/window"; import { useRouter } from "next/router"; -import Link from "next/link"; - -const createWebView = () => { - // if the window already exist close it - - // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it - const webview = new WebviewWindow("default", { - url: "../../../out/media_renderer/index.html", - // url: "https://google.com", - resizable: false, - alwaysOnTop: true, - // focus: true, - // minimizable: false, - // center: true, - // skipTaskbar: true, - }); - - webview.once("tauri://created", function () { - // webview window successfully created - console.log("window created successfully"); - }); - - webview.once("tauri://error", function (e) { - // an error happened creating the webview window - console.log("an error occured while opening the window due to ", e); - }); - - console.log("window successfully created"); - webview.setAlwaysOnTop(true); - webview.center(); - webview.requestUserAttention; - webview.isDecorated(); - webview.setFocus(); -}; +import { useState } from "react"; +import { File } from "../../../core/bindings/File"; // to interface with audio files coming from the application core // the type extends the AppData type @@ -70,7 +37,6 @@ type TFileType = { fileName: string; fileSize: number; status: FileTransferStatus; - // status: 'error' | 'done' | 'pending' | 'completed' | 'downloading' | 'paused'; }; export interface FileTransferInterface { fileType: string; @@ -94,9 +60,12 @@ export default function FileCard({ if (isFolder) { thumbnail = folderIcon; } else { - thumbnail = getFileIcon(fileFormat); + thumbnail = getFileIcon(fileFormat).icon; } + const [openModal, setOpenModal] = useState(false); + + const fileMeta = getFileIcon(fileFormat); const router = useRouter(); // if it is a folder open in folder renderer @@ -109,43 +78,81 @@ export default function FileCard({ } return ( -
{ - // isFolder ? router.push(path): createWebView; - // }} - onClick={createWebView} - className="flex w-full hover:shadow hover:rounded-lg rouned bg-[#f9fbfe] flex-wrap items-center gap-2 cursor-pointer px-4 py-2 last:mb-10 " - > -
- { - file card icon - } -
-
-
- {fileName} -
+ <> + setOpenModal(false)} + onCancel={() => setOpenModal(false)} + centered + okText="" + cancelText="" + okButtonProps={{ hidden: true }} + cancelButtonProps={{ hidden: true }} + width={500} + style={{ height: "1000px!Important" }} + > + +
+ + {fileMeta.type} +
+
+
{ + isFolder ? router.push(path) : setOpenModal(true); + }} + className="flex w-full hover:shadow hover:rounded-lg rouned bg-[#f9fbfe] flex-wrap items-center gap-2 cursor-pointer px-4 py-2 last:mb-10 " + > +
+ { + file card icon + } +
+
+
+ {fileName} +
-
- - {computeFileSize(fileSize as unknown as number)} - + > + + {computeFileSize(fileSize as unknown as number)} + +
-
+ ); } +enum FileType { + Image = "image", + Audio = "audio", + PDF = "pdf", + CSV = "csv", + Presentation = "presentation", + Video = "video", + Archive = "archive", + Document = "document", + Text = "text", + SVG = "svg", + Default = "default", +} + +interface FileTypeResult { + type: FileType; + icon?: string; +} + export function getFileIcon(fileExtension: string) { const imageExtensions = [ "jpg", @@ -356,26 +363,26 @@ export function getFileIcon(fileExtension: string) { const extension = fileExtension.toLocaleLowerCase().trim(); if (imageExtensions.includes(extension)) { - return imageIcon; + return { type: FileType.Image, icon: imageIcon }; } else if (audioExtensions.includes(extension)) { - return audioIcon; + return { type: FileType.Audio, icon: audioIcon }; } else if (pdfExtensions.includes(extension)) { - return pdfIcon; + return { type: FileType.PDF, icon: pdfIcon }; } else if (csvExtensions.includes(extension)) { - return csvIcon; + return { type: FileType.CSV, icon: csvIcon }; } else if (presentationExtensions.includes(extension)) { - return presentationIcon; + return { type: FileType.Presentation, icon: presentationIcon }; } else if (videoExtensions.includes(extension)) { - return videoIcon; + return { type: FileType.Video, icon: videoIcon }; } else if (archiveExtensions.includes(extension)) { - return archiveIcon; + return { type: FileType.Archive, icon: archiveIcon }; } else if (documentExtensions.includes(extension)) { - return documentIcon; + return { type: FileType.Document, icon: documentIcon }; } else if (textExtensions.includes(extension)) { - return textIcon; + return { type: FileType.Text, icon: textIcon }; } else if (svgExtensions.includes(extension)) { - return svgIcon; + return { type: FileType.SVG, icon: svgIcon }; } else { - return defaultIcon; + return { type: FileType.Default, icon: defaultIcon }; } } diff --git a/tsconfig.json b/tsconfig.json index 9ccc58c1..2ad274ff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ "incremental": true, "paths": { "@/*": ["./src/*"], + "@public/*": ["./public/*"], "@binding/*": ["../core/bindings/*"] } }, From dccd8769630fcf693a60d24fc05758c3e62468f5 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 09:49:26 +0100 Subject: [PATCH 10/24] refactor: add media decoder boilerplate --- package.json | 7 +- src/components/Codecs/AudioCodec.tsx | 7 - src/components/Codecs/DocumentCodec.tsx | 7 - src/components/Codecs/MusicCodec.tsx | 7 - src/components/Codecs/VideoCodec.tsx | 7 - src/components/thumbnail/icon-renderer.tsx | 32 ++ src/components/thumbnail/index.tsx | 332 +------------------ src/components/thumbnail/media-icon-maker.ts | 247 ++++++++++++++ src/components/thumbnail/preview-media.tsx | 118 +++++++ src/components/thumbnail/thumbnail-types.ts | 32 ++ viewerjs.d.ts | 1 + yarn.lock | 45 ++- 12 files changed, 489 insertions(+), 353 deletions(-) delete mode 100644 src/components/Codecs/AudioCodec.tsx delete mode 100644 src/components/Codecs/DocumentCodec.tsx delete mode 100644 src/components/Codecs/MusicCodec.tsx delete mode 100644 src/components/Codecs/VideoCodec.tsx create mode 100644 src/components/thumbnail/icon-renderer.tsx create mode 100644 src/components/thumbnail/media-icon-maker.ts create mode 100644 src/components/thumbnail/preview-media.tsx create mode 100644 src/components/thumbnail/thumbnail-types.ts create mode 100644 viewerjs.d.ts diff --git a/package.json b/package.json index 7b13f031..74b9bda0 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,13 @@ "start": "next start", "tauri": "tauri", "lint": "next lint", - "postbuild":"sh ./scripts/copy_renderer_files" + "postbuild": "sh ./scripts/copy_renderer_files" }, "dependencies": { "@headlessui/react": "^1.7.13", "@heroicons/react": "^2.0.16", "@tauri-apps/api": "^1.3.0", + "@types/viewerjs": "^1.0.2", "antd": "^5.6.2", "iqons": "^1.0.4", "next": "^13.2.4", @@ -25,10 +26,12 @@ "react-dom": "^18.2.0", "react-identicon": "^1.0.2", "react-identicons": "^1.2.5", + "react-player": "^2.15.1", "react-qr-code": "^2.0.11", "react-router-dom": "^6.9.0", "tauri-plugin-sqlite-api": "github:lzdyes/tauri-plugin-sqlite#v0.1.1", - "tauri-plugin-store-api": "https://github.com/tauri-apps/tauri-plugin-store#v1" + "tauri-plugin-store-api": "https://github.com/tauri-apps/tauri-plugin-store#v1", + "viewerjs": "^1.11.6" }, "devDependencies": { "@tailwindcss/forms": "^0.5.3", diff --git a/src/components/Codecs/AudioCodec.tsx b/src/components/Codecs/AudioCodec.tsx deleted file mode 100644 index 98b05825..00000000 --- a/src/components/Codecs/AudioCodec.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react' - -export default function AudioCodec() { - return ( -
AudioCodec
- ) -} diff --git a/src/components/Codecs/DocumentCodec.tsx b/src/components/Codecs/DocumentCodec.tsx deleted file mode 100644 index e251bb7a..00000000 --- a/src/components/Codecs/DocumentCodec.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react' - -export default function DocumentCodec() { - return ( -
DocumentCodec
- ) -} diff --git a/src/components/Codecs/MusicCodec.tsx b/src/components/Codecs/MusicCodec.tsx deleted file mode 100644 index 5c866e9a..00000000 --- a/src/components/Codecs/MusicCodec.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react' - -export default function MusicCodec() { - return ( -
MusicCodec
- ) -} diff --git a/src/components/Codecs/VideoCodec.tsx b/src/components/Codecs/VideoCodec.tsx deleted file mode 100644 index 66671122..00000000 --- a/src/components/Codecs/VideoCodec.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react' - -export default function VideoCodec() { - return ( -
VideoCodec
- ) -} diff --git a/src/components/thumbnail/icon-renderer.tsx b/src/components/thumbnail/icon-renderer.tsx new file mode 100644 index 00000000..fe4454c2 --- /dev/null +++ b/src/components/thumbnail/icon-renderer.tsx @@ -0,0 +1,32 @@ +// provide file and folder icon +import { StaticImageData } from "next/image"; +import { getFileIcon } from "./media-icon-maker"; +import folderIcon from "@/assets/common/folder-icon.png"; +import Image from "next/image"; + +export interface ThumbnailIconInterface { + isFolder: boolean; + fileFormat: string; +} + +export default function ThumbnailIcon({ + isFolder, + fileFormat, +}: ThumbnailIconInterface) { + let thumbnail: StaticImageData; + if (isFolder) { + thumbnail = folderIcon; + } else { + thumbnail = getFileIcon(fileFormat).icon; + } + + return ( + file card icon + ); +} diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index 3e7dafbb..117e4e87 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -1,70 +1,23 @@ "use client"; -import archiveIcon from "@/assets/common/archived.png"; -import audioIcon from "@/assets/common/audio.png"; -import csvIcon from "@/assets/common/csv.png"; -import defaultIcon from "@/assets/common/default.png"; -import documentIcon from "@/assets/common/document.png"; -import folderIcon from "@/assets/common/folder-icon.png"; -import imageIcon from "@/assets/common/image.png"; -import pdfIcon from "@/assets/common/pdf.png"; -import presentationIcon from "@/assets/common/presentation.png"; -import svgIcon from "@/assets/common/svg.png"; -import textIcon from "@/assets/common/text.png"; -import videoIcon from "@/assets/common/video.png"; -import { FileTransferStatus } from "@/store/context"; import { computeFileSize } from "@/utils"; import Modal from "antd/es/modal/Modal"; -import Image, { StaticImageData } from "next/image"; import { useRouter } from "next/router"; import { useState } from "react"; import { File } from "../../../core/bindings/File"; - -// to interface with audio files coming from the application core -// the type extends the AppData type -export interface FileInterface extends File {} - -// the required data to render the file card component -export interface FileCardInterface extends FileInterface { - action?: () => void; // the action to perform when the file is clicked, for example it can be used to play an audio file -} - -// the required data to render the file card component -// the data will be passed dynamically - -type TFileType = { - fileType: string; - fileName: string; - fileSize: number; - status: FileTransferStatus; -}; -export interface FileTransferInterface { - fileType: string; - fileName: string; - fileSize: number; - status: FileTransferStatus; -} - -interface Props extends FileCardInterface {} +import PreviewMedia, { FileType } from "./preview-media"; +import { getFileIcon } from "./media-icon-maker"; +import ThumbnailIcon from "./icon-renderer"; export default function FileCard({ fileName, fileFormat, filePath, fileSize, - // action, isFolder, isHidden, -}: Props) { - let thumbnail: StaticImageData; - if (isFolder) { - thumbnail = folderIcon; - } else { - thumbnail = getFileIcon(fileFormat).icon; - } +}: File) { const [openModal, setOpenModal] = useState(false); - - const fileMeta = getFileIcon(fileFormat); const router = useRouter(); @@ -85,18 +38,15 @@ export default function FileCard({ onOk={() => setOpenModal(false)} onCancel={() => setOpenModal(false)} centered - okText="" - cancelText="" okButtonProps={{ hidden: true }} cancelButtonProps={{ hidden: true }} width={500} - style={{ height: "1000px!Important" }} > - -
- - {fileMeta.type} -
+ <> +
+ +
+
{ @@ -104,17 +54,7 @@ export default function FileCard({ }} className="flex w-full hover:shadow hover:rounded-lg rouned bg-[#f9fbfe] flex-wrap items-center gap-2 cursor-pointer px-4 py-2 last:mb-10 " > -
- { - file card icon - } -
+
{fileName} @@ -134,255 +74,3 @@ export default function FileCard({ ); } -enum FileType { - Image = "image", - Audio = "audio", - PDF = "pdf", - CSV = "csv", - Presentation = "presentation", - Video = "video", - Archive = "archive", - Document = "document", - Text = "text", - SVG = "svg", - Default = "default", -} - -interface FileTypeResult { - type: FileType; - icon?: string; -} - -export function getFileIcon(fileExtension: string) { - const imageExtensions = [ - "jpg", - "jpeg", - "png", - "gif", - "bmp", - "tiff", - "raw", - "svg", - "ai", - "eps", - "psd", - "xcf", - "ico", - "webp", - "jxr", - "hdr", - "tif", - "exif", - "pgm", - "ppm", - "pbm", - "pnm", - "heic", - "heif", - "dng", - "cr2", - "nef", - "arw", - "orf", - "rw2", - "sr2", - "raf", - "mrw", - "pef", - "x3f", - "3fr", - "kdc", - "srw", - "nrw", - "rwz", - "rwl", - "iiq", - "rw1", - "r3d", - "fff", - "yuv", - "cin", - "dpx", - "jp2", - "j2k", - "jpf", - "jpx", - "jpm", - "mj2", - "wdp", - "hdp", - "dds", - "pvr", - "tga", - "cur", - "icl", - "thm", - "sai", - "ora", - "pdn", - "kra", - "cpt", - "pdd", - "mng", - "apng", - "svgz", - "emf", - "wmf", - ]; - const documentExtensions = [ - "doc", - "docx", - "rtf", - "odt", - "ods", - "odp", - "odg", - "odp", - "fodp", - "otp", - "doc", - "dot", - "docx", - "docm", - "dotx", - "dotm", - "docb", - "odt", - "fodt", - ]; - const svgExtensions = ["svg"]; - const textExtensions = ["txt"]; - const audioExtensions = [ - "3gp", - "aa", - "aac", - "aax", - "act", - "aiff", - "alac", - "amr", - "ape", - "au", - "awb", - "dss", - "dvf", - "flac", - "gsm", - "iklax", - "ivs", - "m4a", - "m4b", - "m4p", - "mmf", - "movpkg", - "mp3", - "mpc", - "msv", - "nmf", - "ogg", - "oga", - "mogg", - "opus", - "ra", - "rm", - "raw", - "rf64", - "sln", - "tta", - "voc", - "vox", - "wav", - "wma", - "wv", - "webm", - "8svx", - "cda", - ]; - const pdfExtensions = ["pdf"]; - const csvExtensions = ["csv"]; - const presentationExtensions = [ - "ppt", - "pot", - "pps", - "pptx", - "pptm", - "potx", - "potm", - "ppam", - "ppsx", - "ppsm", - "sldx", - "sldm", - "thmx", - ]; - const videoExtensions = [ - "mp4", - "mkv", - "webm", - "flv", - "vob", - "ogv", - "ogg", - "drc", - "gif", - "gifv", - "mng", - "avi", - "MTS", - "MT2S", - "TS", - "mov", - "qt", - "wmv", - "yuv", - "rm", - "rmvb", - "viv", - "asf", - "amv", - "m4p", - "m4v", - "mpg", - "mp2", - "mpeg", - "mpe", - "mpv", - "m2v", - "svi", - "3gp", - "3g2", - "mxf", - "roq", - "nsv", - "f4v", - "f4p", - "f4a", - "f4b", - ]; - const archiveExtensions = ["zip", "rar", "tar", "gz"]; - const extension = fileExtension.toLocaleLowerCase().trim(); - - if (imageExtensions.includes(extension)) { - return { type: FileType.Image, icon: imageIcon }; - } else if (audioExtensions.includes(extension)) { - return { type: FileType.Audio, icon: audioIcon }; - } else if (pdfExtensions.includes(extension)) { - return { type: FileType.PDF, icon: pdfIcon }; - } else if (csvExtensions.includes(extension)) { - return { type: FileType.CSV, icon: csvIcon }; - } else if (presentationExtensions.includes(extension)) { - return { type: FileType.Presentation, icon: presentationIcon }; - } else if (videoExtensions.includes(extension)) { - return { type: FileType.Video, icon: videoIcon }; - } else if (archiveExtensions.includes(extension)) { - return { type: FileType.Archive, icon: archiveIcon }; - } else if (documentExtensions.includes(extension)) { - return { type: FileType.Document, icon: documentIcon }; - } else if (textExtensions.includes(extension)) { - return { type: FileType.Text, icon: textIcon }; - } else if (svgExtensions.includes(extension)) { - return { type: FileType.SVG, icon: svgIcon }; - } else { - return { type: FileType.Default, icon: defaultIcon }; - } -} diff --git a/src/components/thumbnail/media-icon-maker.ts b/src/components/thumbnail/media-icon-maker.ts new file mode 100644 index 00000000..9ce570d2 --- /dev/null +++ b/src/components/thumbnail/media-icon-maker.ts @@ -0,0 +1,247 @@ +// render the folder icon +import { FileType } from "./preview-media"; +import archiveIcon from "@/assets/common/archived.png"; +import audioIcon from "@/assets/common/audio.png"; +import csvIcon from "@/assets/common/csv.png"; +import defaultIcon from "@/assets/common/default.png"; +import documentIcon from "@/assets/common/document.png"; +import imageIcon from "@/assets/common/image.png"; +import pdfIcon from "@/assets/common/pdf.png"; +import presentationIcon from "@/assets/common/presentation.png"; +import svgIcon from "@/assets/common/svg.png"; +import textIcon from "@/assets/common/text.png"; +import videoIcon from "@/assets/common/video.png"; + +export function getFileIcon(fileExtension: string) { + const imageExtensions = [ + "jpg", + "jpeg", + "png", + "gif", + "bmp", + "tiff", + "raw", + "svg", + "ai", + "eps", + "psd", + "xcf", + "ico", + "webp", + "jxr", + "hdr", + "tif", + "exif", + "pgm", + "ppm", + "pbm", + "pnm", + "heic", + "heif", + "dng", + "cr2", + "nef", + "arw", + "orf", + "rw2", + "sr2", + "raf", + "mrw", + "pef", + "x3f", + "3fr", + "kdc", + "srw", + "nrw", + "rwz", + "rwl", + "iiq", + "rw1", + "r3d", + "fff", + "yuv", + "cin", + "dpx", + "jp2", + "j2k", + "jpf", + "jpx", + "jpm", + "mj2", + "wdp", + "hdp", + "dds", + "pvr", + "tga", + "cur", + "icl", + "thm", + "sai", + "ora", + "pdn", + "kra", + "cpt", + "pdd", + "mng", + "apng", + "svgz", + "emf", + "wmf", + ]; + const documentExtensions = [ + "doc", + "docx", + "rtf", + "odt", + "ods", + "odp", + "odg", + "odp", + "fodp", + "otp", + "doc", + "dot", + "docx", + "docm", + "dotx", + "dotm", + "docb", + "odt", + "fodt", + ]; + const svgExtensions = ["svg"]; + const textExtensions = ["txt"]; + const audioExtensions = [ + "3gp", + "aa", + "aac", + "aax", + "act", + "aiff", + "alac", + "amr", + "ape", + "au", + "awb", + "dss", + "dvf", + "flac", + "gsm", + "iklax", + "ivs", + "m4a", + "m4b", + "m4p", + "mmf", + "movpkg", + "mp3", + "mpc", + "msv", + "nmf", + "ogg", + "oga", + "mogg", + "opus", + "ra", + "rm", + "raw", + "rf64", + "sln", + "tta", + "voc", + "vox", + "wav", + "wma", + "wv", + "webm", + "8svx", + "cda", + ]; + const pdfExtensions = ["pdf"]; + const csvExtensions = ["csv"]; + const presentationExtensions = [ + "ppt", + "pot", + "pps", + "pptx", + "pptm", + "potx", + "potm", + "ppam", + "ppsx", + "ppsm", + "sldx", + "sldm", + "thmx", + ]; + const videoExtensions = [ + "mp4", + "mkv", + "webm", + "flv", + "vob", + "ogv", + "ogg", + "drc", + "gif", + "gifv", + "mng", + "avi", + "MTS", + "MT2S", + "TS", + "mov", + "qt", + "wmv", + "yuv", + "rm", + "rmvb", + "viv", + "asf", + "amv", + "m4p", + "m4v", + "mpg", + "mp2", + "mpeg", + "mpe", + "mpv", + "m2v", + "svi", + "3gp", + "3g2", + "mxf", + "roq", + "nsv", + "f4v", + "f4p", + "f4a", + "f4b", + ]; + const archiveExtensions = ["zip", "rar", "tar", "gz"]; + const extension = fileExtension.toLocaleLowerCase().trim(); + + if (imageExtensions.includes(extension)) { + return { type: FileType.Image, icon: imageIcon }; + } else if (audioExtensions.includes(extension)) { + return { type: FileType.Audio, icon: audioIcon }; + } else if (pdfExtensions.includes(extension)) { + return { type: FileType.PDF, icon: pdfIcon }; + } else if (csvExtensions.includes(extension)) { + return { type: FileType.CSV, icon: csvIcon }; + } else if (presentationExtensions.includes(extension)) { + return { type: FileType.Presentation, icon: presentationIcon }; + } else if (videoExtensions.includes(extension)) { + return { type: FileType.Video, icon: videoIcon }; + } else if (archiveExtensions.includes(extension)) { + return { type: FileType.Archive, icon: archiveIcon }; + } else if (documentExtensions.includes(extension)) { + return { type: FileType.Document, icon: documentIcon }; + } else if (textExtensions.includes(extension)) { + return { type: FileType.Text, icon: textIcon }; + } else if (svgExtensions.includes(extension)) { + return { type: FileType.SVG, icon: svgIcon }; + } else { + return { type: FileType.Default, icon: defaultIcon }; + } +} diff --git a/src/components/thumbnail/preview-media.tsx b/src/components/thumbnail/preview-media.tsx new file mode 100644 index 00000000..f2ccdcc2 --- /dev/null +++ b/src/components/thumbnail/preview-media.tsx @@ -0,0 +1,118 @@ +/// give preview for differet file type +// import Viewer from "viewerjs"; +// import Viewer from "viewerjs/dist/viewer.esm"; +import "viewerjs/dist/viewer.min.css"; + +export enum FileType { + Image = "image", + Audio = "audio", + PDF = "pdf", + CSV = "csv", + Presentation = "presentation", + Video = "video", + Archive = "archive", + Document = "document", + Text = "text", + SVG = "svg", + Default = "default", +} + +interface Props { + fileType: FileType; + filePath: string; +} + +// export const ImageViewer = new Viewer( +// document?.getElementById("image-viewer")!, +// { +// inline: false, +// viewed() { +// ImageViewer.zoomTo(2); +// }, +// } +// ); + + + +// {fileName}; + + +export default function PreviewMedia({ fileType, filePath }: Props) { + switch (fileType) { + case FileType.Archive: + return ( + <> +

archive file

+ + ); + case FileType.Audio: + return ( + <> +

audio file

+ + ); + case FileType.CSV: + return ( + <> +

csv file

+ + ); + case FileType.Document: + return ( + <> +

document file

+ + ); + case FileType.Image: + return ( + <> +

image file

+ + ); + case FileType.PDF: + return ( + <> +

pdf file

+ + ); + case FileType.Presentation: + return ( + <> +

presentation file

+ + ); + case FileType.SVG: + return ( + <> +

svg file

+ + ); + case FileType.Text: + return ( + <> +

text file

+ + ); + case FileType.Video: + return ( + <> +

video file

+ + ); + default: + return ( + <> +

default file

+ + ); + } + + +} diff --git a/src/components/thumbnail/thumbnail-types.ts b/src/components/thumbnail/thumbnail-types.ts new file mode 100644 index 00000000..671d10c7 --- /dev/null +++ b/src/components/thumbnail/thumbnail-types.ts @@ -0,0 +1,32 @@ + +// to interface with audio files coming from the application core + +import { FileTransferStatus } from "@/store/context"; + +// the type extends the AppData type +export interface FileInterface extends File {} + +// the required data to render the file card component +export interface FileCardInterface extends FileInterface { + action?: () => void; // the action to perform when the file is clicked, for example it can be used to play an audio file +} + +// the required data to render the file card component +// the data will be passed dynamically + +export type TFileType = { + fileType: string; + fileName: string; + fileSize: number; + status: FileTransferStatus; +}; + + +export interface FileTransferInterface { + fileType: string; + fileName: string; + fileSize: number; + status: FileTransferStatus; +} + +export interface Props extends FileCardInterface {} \ No newline at end of file diff --git a/viewerjs.d.ts b/viewerjs.d.ts new file mode 100644 index 00000000..ad806c36 --- /dev/null +++ b/viewerjs.d.ts @@ -0,0 +1 @@ +declare module 'viewerjs' \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index aaa1366a..7d6193ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -789,6 +789,13 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== +"@types/viewerjs@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/viewerjs/-/viewerjs-1.0.2.tgz#f4a5b1ff376c74bc89ff6652f072a6217a596f8a" + integrity sha512-IQj7e29b6gRpkXbj8H5l0TlHsrCQP+YasYozr85aLX4No4UJgvthHUYbzFkSPUZdcNEKRCIJY+7rR4DTfC0AQw== + dependencies: + viewerjs "*" + "@typescript-eslint/parser@^5.42.0": version "5.60.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.60.0.tgz#08f4daf5fc6548784513524f4f2f359cebb4068a" @@ -1314,6 +1321,11 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +deepmerge@^4.0.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + default-browser-id@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" @@ -2372,6 +2384,11 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== +load-script@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/load-script/-/load-script-1.0.0.tgz#0491939e0bee5643ee494a7e3da3d2bac70c6ca4" + integrity sha512-kPEjMFtZvwL9TaZo0uZ2ml+Ye9HUMmPwbYRJ324qF9tqMejwykJ5ggTyvzmrbBeapCAbk98BSbTeovHEEP1uCA== + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -2417,6 +2434,11 @@ magic-string@^0.27.0: dependencies: "@jridgewell/sourcemap-codec" "^1.4.13" +memoize-one@^5.1.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e" + integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -2790,7 +2812,7 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prop-types@^15.8.1: +prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -3190,6 +3212,11 @@ react-dom@^18.2.0: loose-envify "^1.1.0" scheduler "^0.23.0" +react-fast-compare@^3.0.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49" + integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== + react-identicon@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/react-identicon/-/react-identicon-1.0.2.tgz#79ee46541e3665c873733b113496e71ea6a87264" @@ -3211,6 +3238,17 @@ react-is@^16.12.0, react-is@^16.13.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-player@^2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/react-player/-/react-player-2.15.1.tgz#a5905126a6c5ba2667391a0d72da9f3a1ab57d54" + integrity sha512-ni1XFuYZuhIKKdeFII+KRLmIPcvCYlyXvtSMhNOgssdfnSovmakBtBTW2bxowPvmpKy5BTR4jC4CF79ucgHT+g== + dependencies: + deepmerge "^4.0.0" + load-script "^1.0.0" + memoize-one "^5.1.1" + prop-types "^15.7.2" + react-fast-compare "^3.0.1" + react-qr-code@^2.0.11: version "2.0.11" resolved "https://registry.yarnpkg.com/react-qr-code/-/react-qr-code-2.0.11.tgz#444c759a2100424972e17135fbe0e32eaffa19e8" @@ -3765,6 +3803,11 @@ util-deprecate@^1.0.2: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +viewerjs@*, viewerjs@^1.11.6: + version "1.11.6" + resolved "https://registry.yarnpkg.com/viewerjs/-/viewerjs-1.11.6.tgz#19a1e78c15eba5a9fbbf34ebc5ab312d6e8932ed" + integrity sha512-TlhdSp2oEOLFXvEp4psKaeTjR5zBjTRcM/sHUN8PkV1UWuY8HKC8n7GaVdW5Xqnwdr/F1OmzLik1QwDjI4w/nw== + vite@^4.0.0: version "4.3.9" resolved "https://registry.yarnpkg.com/vite/-/vite-4.3.9.tgz#db896200c0b1aa13b37cdc35c9e99ee2fdd5f96d" From e27fdaa421dc4a328aa61a1be6afbd1604a6c2e9 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 11:15:38 +0100 Subject: [PATCH 11/24] feat: media codec --- .gitignore | 4 +- next.config.js | 21 +- package.json | 4 + react-file-viewer.d.ts | 1 + src/components/thumbnail/index.tsx | 2 +- src/components/thumbnail/preview-media.tsx | 110 +-- yarn.lock | 809 ++++++++++++++++++++- 7 files changed, 829 insertions(+), 122 deletions(-) create mode 100644 react-file-viewer.d.ts diff --git a/.gitignore b/.gitignore index 8c6fd78b..83d16d1c 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,6 @@ core/views mobile/node_modules core/test.db -core/src/scripts \ No newline at end of file +core/src/scripts + +public/test \ No newline at end of file diff --git a/next.config.js b/next.config.js index d3b7c018..a0e57954 100644 --- a/next.config.js +++ b/next.config.js @@ -1,12 +1,17 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: true, - // Note: This feature is required to use NextJS Image in SSG mode. - // See https://nextjs.org/docs/messages/export-image-api for different workarounds. - images: { - unoptimized: true, - }, -} + reactStrictMode: true, + // Note: This feature is required to use NextJS Image in SSG mode. + // See https://nextjs.org/docs/messages/export-image-api for different workarounds. + images: { + unoptimized: true, + }, -module.exports = nextConfig \ No newline at end of file +// webpack: (config) => { +// config.resolve.alias.canvas = false; +// return config; +// }, +}; + +module.exports = nextConfig; diff --git a/package.json b/package.json index 74b9bda0..17c35c92 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "postbuild": "sh ./scripts/copy_renderer_files" }, "dependencies": { + "@cyntler/react-doc-viewer": "^1.14.1", "@headlessui/react": "^1.7.13", "@heroicons/react": "^2.0.16", "@tauri-apps/api": "^1.3.0", @@ -24,11 +25,14 @@ "next": "^13.2.4", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-file-viewer": "^1.2.1", "react-identicon": "^1.0.2", "react-identicons": "^1.2.5", + "react-pdf": "^7.7.1", "react-player": "^2.15.1", "react-qr-code": "^2.0.11", "react-router-dom": "^6.9.0", + "react-simple-image-viewer": "^1.2.2", "tauri-plugin-sqlite-api": "github:lzdyes/tauri-plugin-sqlite#v0.1.1", "tauri-plugin-store-api": "https://github.com/tauri-apps/tauri-plugin-store#v1", "viewerjs": "^1.11.6" diff --git a/react-file-viewer.d.ts b/react-file-viewer.d.ts new file mode 100644 index 00000000..8db23f9b --- /dev/null +++ b/react-file-viewer.d.ts @@ -0,0 +1 @@ +declare module "react-file-viewer"; \ No newline at end of file diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index 117e4e87..ef3cf740 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -44,7 +44,7 @@ export default function FileCard({ > <>
- +
diff --git a/src/components/thumbnail/preview-media.tsx b/src/components/thumbnail/preview-media.tsx index f2ccdcc2..1d1455df 100644 --- a/src/components/thumbnail/preview-media.tsx +++ b/src/components/thumbnail/preview-media.tsx @@ -1,7 +1,7 @@ -/// give preview for differet file type -// import Viewer from "viewerjs"; -// import Viewer from "viewerjs/dist/viewer.esm"; -import "viewerjs/dist/viewer.min.css"; +"use client"; + +/// give preview for differet file type +import FileViewer from "react-file-viewer"; export enum FileType { Image = "image", @@ -18,101 +18,17 @@ export enum FileType { } interface Props { - fileType: FileType; + fileType: string; filePath: string; } -// export const ImageViewer = new Viewer( -// document?.getElementById("image-viewer")!, -// { -// inline: false, -// viewed() { -// ImageViewer.zoomTo(2); -// }, -// } -// ); - - - -// {fileName}; - - export default function PreviewMedia({ fileType, filePath }: Props) { - switch (fileType) { - case FileType.Archive: - return ( - <> -

archive file

- - ); - case FileType.Audio: - return ( - <> -

audio file

- - ); - case FileType.CSV: - return ( - <> -

csv file

- - ); - case FileType.Document: - return ( - <> -

document file

- - ); - case FileType.Image: - return ( - <> -

image file

- - ); - case FileType.PDF: - return ( - <> -

pdf file

- - ); - case FileType.Presentation: - return ( - <> -

presentation file

- - ); - case FileType.SVG: - return ( - <> -

svg file

- - ); - case FileType.Text: - return ( - <> -

text file

- - ); - case FileType.Video: - return ( - <> -

video file

- - ); - default: - return ( - <> -

default file

- - ); - } - - + return ( + + ); } diff --git a/yarn.lock b/yarn.lock index 7d6193ee..7c228cdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -274,11 +274,40 @@ resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.6.0.tgz#53fa5fe9c34faee89469e48f91d51a3766108bc8" integrity sha512-/Z3l6pXthq0JvMYdUFyX9j0MaCltlIn6mfh9jLyQwg5aPKxkyNa0PTHtU1AlFXLNk55ZuAeJRcpvq+tmLfKmaQ== +"@cyntler/react-doc-viewer@^1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@cyntler/react-doc-viewer/-/react-doc-viewer-1.14.1.tgz#562d0158b86f67142b1098925ea0bf65684ddaaf" + integrity sha512-1LiYewtiLM6FZgkJmlAiibv3zeiDinII+WKjViLeaD7O9yP+F9TqYyYSTR05crZODltzHenn/Tcx9YesV9tKtA== + dependencies: + "@types/mustache" "^4.2.3" + "@types/papaparse" "^5.3.9" + mustache "^4.2.0" + papaparse "^5.4.1" + react-pdf "7.5.0" + styled-components "^6.0.8" + "@emotion/hash@^0.8.0": version "0.8.0" resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.8.0.tgz#bbbff68978fefdbe68ccb533bc8cbe1d1afb5413" integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow== +"@emotion/is-prop-valid@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-1.2.1.tgz#23116cf1ed18bfeac910ec6436561ecb1a3885cc" + integrity sha512-61Mf7Ufx4aDxx1xlDeOm8aFFigGHE4z+0sKCa+IHCeZKiyP9RLD0Mmx7m8b9/Cf37f7NAvQOOJAbQQGVr5uERw== + dependencies: + "@emotion/memoize" "^0.8.1" + +"@emotion/memoize@^0.8.1": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.8.1.tgz#c1ddb040429c6d21d38cc945fe75c818cfb68e17" + integrity sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA== + +"@emotion/unitless@0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.8.0.tgz#a4a36e9cbdc6903737cd20d38033241e1b8833db" + integrity sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw== + "@emotion/unitless@^0.7.5": version "0.7.5" resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" @@ -494,6 +523,21 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" +"@mapbox/node-pre-gyp@^1.0.0": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz#417db42b7f5323d79e93b34a6d7a2a12c0df43fa" + integrity sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ== + dependencies: + detect-libc "^2.0.0" + https-proxy-agent "^5.0.0" + make-dir "^3.1.0" + node-fetch "^2.6.7" + nopt "^5.0.0" + npmlog "^5.0.1" + rimraf "^3.0.2" + semver "^7.3.5" + tar "^6.1.11" + "@next/env@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.7.tgz#ca12d341edb128ca70384635bd2794125ffb1c01" @@ -758,11 +802,30 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/mustache@^4.2.3": + version "4.2.5" + resolved "https://registry.yarnpkg.com/@types/mustache/-/mustache-4.2.5.tgz#9129f0d6857f976e00e171bbb3460e4b702f84ef" + integrity sha512-PLwiVvTBg59tGFL/8VpcGvqOu3L4OuveNvPi0EYbWchRdEVP++yRUXJPFl+CApKEq13017/4Nf7aQ5lTtHUNsA== + +"@types/node@*": + version "20.12.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.6.tgz#72d068870518d7da1d97b49db401e2d6a1805294" + integrity sha512-3KurE8taB8GCvZBPngVbp0lk5CKi8M9f9k1rsADh0Evdz5SzJ+Q+Hx9uHoFGsLnLnd1xmkDQr2hVhlA0Mn0lKQ== + dependencies: + undici-types "~5.26.4" + "@types/node@^18.7.10": version "18.16.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.18.tgz#85da09bafb66d4bc14f7c899185336d0c1736390" integrity sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw== +"@types/papaparse@^5.3.9": + version "5.3.14" + resolved "https://registry.yarnpkg.com/@types/papaparse/-/papaparse-5.3.14.tgz#345cc2a675a90106ff1dc33b95500dfb30748031" + integrity sha512-LxJ4iEFcpqc6METwp9f6BV6VVc43m6MfH0VqFosHvrUgfXiFe6ww7R3itkOQ+TCK6Y+Iv/+RnnvtRZnkc5Kc9g== + dependencies: + "@types/node" "*" + "@types/prop-types@*": version "15.7.5" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf" @@ -789,6 +852,11 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== +"@types/stylis@4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.2.0.tgz#199a3f473f0c3a6f6e4e1b17cdbc967f274bdc6b" + integrity sha512-n4sx2bqL0mW1tvDf/loQ+aMX7GQD3lc3fkCMC55VFNDu/vBOabO+LTIeXKM14xK0ppk5TUGcWRjiSpIlUpghKw== + "@types/viewerjs@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@types/viewerjs/-/viewerjs-1.0.2.tgz#f4a5b1ff376c74bc89ff6652f072a6217a596f8a" @@ -859,6 +927,11 @@ MD5@^1.2.2: charenc ">= 0.0.1" crypt ">= 0.0.1" +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -869,6 +942,31 @@ acorn@^8.8.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59" integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== +adler-32@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/adler-32/-/adler-32-1.1.0.tgz#03551a5c7f0edfbd4fc8fa12a6814978eab651c3" + integrity sha512-lRKKX9RZQBPy6CrdUqiDUsxVcZujjbkkUg++0zLLyi0EwRui+aFyEDJBXRXCqwp+pmmybdZgBNHxOAOQcgdJYg== + dependencies: + exit-on-epipe "~1.0.1" + printj "~1.1.0" + +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ajv@^5.0.0: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + integrity sha512-Ajr4IcMXq/2QmMkEmSvxqfLN5zGmJ92gHXAeOXq1OekoH2rfDNsgdDoL2f7QaRCy7G/E6TpxBVdRuNraMztGHw== + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -965,6 +1063,19 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +"aproba@^1.0.3 || ^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" + integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== + +are-we-there-yet@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz#372e0e7bd279d8e94c653aaa1f67200884bf3e1c" + integrity sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw== + dependencies: + delegates "^1.0.0" + readable-stream "^3.6.0" + arg@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" @@ -975,6 +1086,13 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +argparse@~1.0.3: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + aria-query@^5.1.3: version "5.2.1" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.2.1.tgz#bc285d9d654d1df121bcd0c134880d415ca67c15" @@ -1091,6 +1209,11 @@ big-integer@^1.6.44: resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== +big.js@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" + integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -1101,6 +1224,11 @@ bluebird@^2.9.30: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" integrity sha512-UfFSr22dmHPQqPP9XWHRhq+gWnHCYguQGkXQlbyPtW5qTnhFWA8/iXg765tH0cAjy7l/zPJ1aBTO0g5XgA7kvQ== +bluebird@~3.4.0: + version "3.4.7" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" + integrity sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA== + bplist-parser@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" @@ -1165,11 +1293,33 @@ camelcase-css@^2.0.1: resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5" integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== +camelize@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.1.tgz#89b7e16884056331a35d6b5ad064332c91daa6c3" + integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== + caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001503: version "1.0.30001506" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001506.tgz#35bd814b310a487970c585430e9e80ee23faf14b" integrity sha512-6XNEcpygZMCKaufIcgpQNZNf00GEqc7VQON+9Rd0K1bMYo8xhMZRAo5zpbnbMNizi4YNgIDAFrdykWsvY3H4Hw== +canvas@^2.11.2: + version "2.11.2" + resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.11.2.tgz#553d87b1e0228c7ac0fc72887c3adbac4abbd860" + integrity sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw== + dependencies: + "@mapbox/node-pre-gyp" "^1.0.0" + nan "^2.17.0" + simple-get "^3.0.3" + +cfb@~0.12.0: + version "0.12.1" + resolved "https://registry.yarnpkg.com/cfb/-/cfb-0.12.1.tgz#57fadfa9fc31409b2ca58a4109ecaaac5ad1a4ec" + integrity sha512-cP+4A0tTqtyza5gJwNwDetZ8FPjl0gPLE7mIxGKyUzOS6HkM23WaAWW/l3t7jIQSMqVXroa09Ey0lo7gV8LNxw== + dependencies: + commander "~2.11.0" + printj "~1.1.0" + chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -1207,6 +1357,11 @@ chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" @@ -1217,6 +1372,25 @@ client-only@0.0.1, client-only@^0.0.1: resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== +clsx@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb" + integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg== + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +codepage@~1.10.1: + version "1.10.2" + resolved "https://registry.yarnpkg.com/codepage/-/codepage-1.10.2.tgz#bebd25224dc626a0007ea014e076ce057374769e" + integrity sha512-JzhJ7nYua7rMcJ6I4Cw4h1w7aN/1f5qAQb//QSAaTjTVjEEZ1mBicBWTPLf6RiaBn4dpbEFwqGBoEekOHx9K2Q== + dependencies: + commander "~2.11.0" + exit-on-epipe "~1.0.1" + voc "~1.0.0" + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -1241,11 +1415,26 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-support@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" + integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== + +comma-separated-values@^3.6.4: + version "3.6.4" + resolved "https://registry.yarnpkg.com/comma-separated-values/-/comma-separated-values-3.6.4.tgz#c309ec7024f74b7ae19223372054242617e35bd2" + integrity sha512-B0mjBHUfu4JqzYM5NurRTBl2QuNqQ9/O62EUfL4+bo2KN81fGsFOFOHbHn5SP65n3lmFPzGLkdg8wfuLKk9HOQ== + commander@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== +commander@~2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== + compute-scroll-into-view@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.0.3.tgz#c418900a5c56e2b04b885b54995df164535962b1" @@ -1256,6 +1445,11 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +console-control-strings@^1.0.0, console-control-strings@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== + convert-source-map@^1.7.0: version "1.9.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" @@ -1268,6 +1462,14 @@ copy-to-clipboard@^3.2.0: dependencies: toggle-selection "^1.0.6" +crc-32@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.1.1.tgz#5d739d5e4c6e352ad8304d73223d483fe55adb8d" + integrity sha512-DWXuRN3Wtu43YRfYZ9r17720WZqM0caEjIfT6Dk1J/3sAxIyyXbUWqIACbz3cjV8l7guJRW+9pZlYMluKJ69wg== + dependencies: + exit-on-epipe "~1.0.1" + printj "~1.1.0" + cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -1282,12 +1484,26 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== +css-color-keywords@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05" + integrity sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg== + +css-to-react-native@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-3.2.0.tgz#cdd8099f71024e149e4f6fe17a7d46ecd55f1e32" + integrity sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ== + dependencies: + camelize "^1.0.0" + css-color-keywords "^1.0.0" + postcss-value-parser "^4.0.2" + cssesc@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -csstype@^3.0.10, csstype@^3.0.2: +csstype@3.1.2, csstype@^3.0.10, csstype@^3.0.2: version "3.1.2" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== @@ -1302,6 +1518,13 @@ dayjs@^1.11.1: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.8.tgz#4282f139c8c19dd6d0c7bd571e30c2d0ba7698ea" integrity sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ== +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -1309,12 +1532,12 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== +decompress-response@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" + integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== dependencies: - ms "2.1.2" + mimic-response "^2.0.0" deep-is@^0.1.3: version "0.1.4" @@ -1357,11 +1580,21 @@ define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== + dequal@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== +detect-libc@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" + integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== + didyoumean@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" @@ -1398,16 +1631,33 @@ dom-align@^1.7.0: resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.12.4.tgz#3503992eb2a7cfcb2ed3b2a6d21e0b9c00d54511" integrity sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw== +duck@^0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/duck/-/duck-0.1.12.tgz#de7adf758421230b6d7aee799ce42670586b9efa" + integrity sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg== + dependencies: + underscore "^1.13.1" + electron-to-chromium@^1.4.431: version "1.4.436" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.436.tgz#2aa6e1644693d25cb438a873fba72ec901e1be30" integrity sha512-aktOxo8fnrMC8vOIBMVS3PXbT1nrPQ+SouUuN7Y0a+Rw3pOMrvIV92Ybnax7x4tugA+ZpYA5fOHTby7ama8OQQ== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + emoji-regex@^9.2.2: version "9.2.2" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== +emojis-list@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" + integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q== + enhanced-resolve@^5.12.0: version "5.15.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" @@ -1760,6 +2010,16 @@ execa@^7.1.1: signal-exit "^3.0.7" strip-final-newline "^3.0.0" +exit-on-epipe@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692" + integrity sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw== + +fast-deep-equal@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha512-fueX787WZKCV0Is4/T2cyAdM4+x1S3MXXOAhavE1ys/W42SHAPacLTQhucja22QBYrfGw50M2sRiXPtTGv9Ymw== + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -1835,11 +2095,23 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +frac@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/frac/-/frac-1.1.2.tgz#3d74f7f6478c88a1b5020306d747dc6313c74d0b" + integrity sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA== + fraction.js@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950" integrity sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA== +fs-minipass@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" + integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== + dependencies: + minipass "^3.0.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -1870,6 +2142,21 @@ functions-have-names@^1.2.2, functions-have-names@^1.2.3: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +gauge@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-3.0.2.tgz#03bf4441c044383908bcfa0656ad91803259b395" + integrity sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q== + dependencies: + aproba "^1.0.3 || ^2.0.0" + color-support "^1.1.2" + console-control-strings "^1.0.0" + has-unicode "^2.0.1" + object-assign "^4.1.1" + signal-exit "^3.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + wide-align "^1.1.2" + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -2058,6 +2345,11 @@ has-tostringtag@^1.0.0: dependencies: has-symbols "^1.0.2" +has-unicode@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -2065,6 +2357,14 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -2101,7 +2401,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2185,6 +2485,11 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" @@ -2317,6 +2622,11 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha512-4JD/Ivzg7PoW8NzdrBSr3UFwC9mHgvI7Z6z3QGBsSHgKaRTUDmyZAAKJo2UbG1kUVfS9WS8bi36N49U1xw43DA== + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -2334,7 +2644,7 @@ json2mq@^0.2.0: dependencies: string-convert "^0.2.0" -json5@^1.0.2: +json5@^1.0.1, json5@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== @@ -2354,6 +2664,13 @@ json5@^2.2.2: array-includes "^3.1.5" object.assign "^4.1.3" +jszip@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/jszip/-/jszip-2.5.0.tgz#7444fd8551ddf3e5da7198fea0c91bc8308cc274" + integrity sha512-IRoyf8JSYY3nx+uyh5xPc0qdy8pUDTp2UkHOWYNF/IO/3D8nx7899UlSAjD8rf8wUgOmm0lACWx/GbW3EaxIXQ== + dependencies: + pako "~0.2.5" + language-subtag-registry@~0.3.2: version "0.3.22" resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz#2e1500861b2e457eba7e7ae86877cbd08fa1fd1d" @@ -2389,6 +2706,15 @@ load-script@^1.0.0: resolved "https://registry.yarnpkg.com/load-script/-/load-script-1.0.0.tgz#0491939e0bee5643ee494a7e3da3d2bac70c6ca4" integrity sha512-kPEjMFtZvwL9TaZo0uZ2ml+Ye9HUMmPwbYRJ324qF9tqMejwykJ5ggTyvzmrbBeapCAbk98BSbTeovHEEP1uCA== +loader-utils@^1.0.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3" + integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg== + dependencies: + big.js "^5.2.2" + emojis-list "^3.0.0" + json5 "^1.0.1" + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -2401,18 +2727,27 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^3.9.3: +lodash@^3.5.0, lodash@^3.9.3: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== -loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: js-tokens "^3.0.0 || ^4.0.0" +lop@~0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/lop/-/lop-0.4.1.tgz#744f1696ef480e68ce1947fe557b09db5af2a738" + integrity sha512-9xyho9why2A2tzm5aIcMWKvzqKsnxrf9B5I+8O30olh6lQU8PH978LqZoI4++37RBgS1Em5i54v1TFs/3wnmXQ== + dependencies: + duck "^0.1.12" + option "~0.2.1" + underscore "^1.13.1" + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -2434,11 +2769,47 @@ magic-string@^0.27.0: dependencies: "@jridgewell/sourcemap-codec" "^1.4.13" +make-cancellable-promise@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/make-cancellable-promise/-/make-cancellable-promise-1.3.2.tgz#993c8c8b79cff13c74fa93de0bd8a17fe66685c1" + integrity sha512-GCXh3bq/WuMbS+Ky4JBPW1hYTOU+znU+Q5m9Pu+pI8EoUqIHk9+tviOKC6/qhHh8C4/As3tzJ69IF32kdz85ww== + +make-dir@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + +make-event-props@^1.6.0: + version "1.6.2" + resolved "https://registry.yarnpkg.com/make-event-props/-/make-event-props-1.6.2.tgz#c8e0e48eb28b9b808730de38359f6341de7ec5a2" + integrity sha512-iDwf7mA03WPiR8QxvcVHmVWEPfMY1RZXerDVNCRYW7dUr2ppH3J58Rwb39/WG39yTZdRSxr3x+2v22tvI0VEvA== + +mammoth@1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/mammoth/-/mammoth-1.3.6.tgz#9469203bd338dda19ff9066a06c4257076db97c7" + integrity sha512-hr1HqQg49PAcFDsj1RMHo2l+fxEVocUTbJ37kGoUIV1mt6dn2Wd7T381NdHagnvQ1Jblv0E+BtghEVnxd0sqwQ== + dependencies: + argparse "~1.0.3" + bluebird "~3.4.0" + jszip "~2.5.0" + lop "~0.4.0" + path-is-absolute "^1.0.0" + sax "~1.1.1" + underscore "~1.6.0" + xmlbuilder "~2.6.4" + memoize-one@^5.1.1: version "5.2.1" resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e" integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q== +merge-refs@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/merge-refs/-/merge-refs-1.2.2.tgz#6142633398dd0d10a37626cae77ddeb1db26db0c" + integrity sha512-RwcT7GsQR3KbuLw1rRuodq4Nt547BKEBkliZ0qqsrpyNne9bGTFtsFIsIpx82huWhcl3kOlOlH4H0xkPk/DqVw== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -2467,6 +2838,11 @@ mimic-fn@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== +mimic-response@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" + integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== + mini-svg-data-uri@^1.2.3: version "1.4.4" resolved "https://registry.yarnpkg.com/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz#8ab0aabcdf8c29ad5693ca595af19dd2ead09939" @@ -2484,6 +2860,31 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +minipass@^3.0.0: + version "3.3.6" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a" + integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw== + dependencies: + yallist "^4.0.0" + +minipass@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" + integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== + +minizlib@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" + integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + +mkdirp@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -2494,6 +2895,11 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +mustache@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== + mz@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -2503,6 +2909,11 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" +nan@^2.17.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.19.0.tgz#bb58122ad55a6c5bc973303908d5b16cfdd5a8c0" + integrity sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw== + nanoid@^3.3.4, nanoid@^3.3.6: version "3.3.6" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" @@ -2537,11 +2948,30 @@ next@^13.2.4: "@next/swc-win32-ia32-msvc" "13.4.7" "@next/swc-win32-x64-msvc" "13.4.7" +node-ensure@^0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/node-ensure/-/node-ensure-0.0.0.tgz#ecae764150de99861ec5c810fd5d096b183932a7" + integrity sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw== + +node-fetch@^2.6.7: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + node-releases@^2.0.12: version "2.0.12" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.12.tgz#35627cc224a23bfb06fb3380f2b3afaaa7eb1039" integrity sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ== +nopt@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" + integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== + dependencies: + abbrev "1" + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" @@ -2566,6 +2996,16 @@ npm-run-path@^5.1.0: dependencies: path-key "^4.0.0" +npmlog@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-5.0.1.tgz#f06678e80e29419ad67ab964e0fa69959c1eb8b0" + integrity sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw== + dependencies: + are-we-there-yet "^2.0.0" + console-control-strings "^1.1.0" + gauge "^3.0.0" + set-blocking "^2.0.0" + object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -2631,7 +3071,7 @@ object.values@^1.1.6: define-properties "^1.1.4" es-abstract "^1.20.4" -once@^1.3.0: +once@^1.3.0, once@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -2662,6 +3102,11 @@ open@^9.1.0: is-inside-container "^1.0.0" is-wsl "^2.2.0" +option@~0.2.1: + version "0.2.4" + resolved "https://registry.yarnpkg.com/option/-/option-0.2.4.tgz#fd475cdf98dcabb3cb397a3ba5284feb45edbfe4" + integrity sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A== + optionator@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" @@ -2688,6 +3133,16 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" +pako@~0.2.5: + version "0.2.9" + resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" + integrity sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA== + +papaparse@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/papaparse/-/papaparse-5.4.1.tgz#f45c0f871853578bd3a30f92d96fdcfb6ebea127" + integrity sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -2725,6 +3180,34 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +path2d-polyfill@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/path2d-polyfill/-/path2d-polyfill-2.1.1.tgz#6098b7bf2fc24c306c6377bcd558b17ba437ea27" + integrity sha512-4Rka5lN+rY/p0CdD8+E+BFv51lFaFvJOrlOhyQ+zjzyQrzyh3ozmxd1vVGGDdIbUFSBtIZLSnspxTgPT0iJhvA== + dependencies: + path2d "0.1.1" + +path2d@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/path2d/-/path2d-0.1.1.tgz#d3c3886cd2252fb2a7830c27ea7bb9a862d937ea" + integrity sha512-/+S03c8AGsDYKKBtRDqieTJv2GlkMb0bWjnqOgtF6MkjdUQ9a8ARAtxWf9NgKLGm2+WQr6+/tqJdU8HNGsIDoA== + +pdfjs-dist@1.8.357: + version "1.8.357" + resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-1.8.357.tgz#85c24944e81b67080656a60dd7b58f3a33fbd084" + integrity sha512-ampPgu+QHnreVkCebVprhKvFX7Z+K5Zf5vQdFc7d48pzJgg9//lv4mjpZbrX+j5nSocrbEZZPnyHdN/5zjf39w== + dependencies: + node-ensure "^0.0.0" + worker-loader "^0.8.0" + +pdfjs-dist@3.11.174: + version "3.11.174" + resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz#5ff47b80f2d58c8dd0d74f615e7c6a7e7e704c4b" + integrity sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA== + optionalDependencies: + canvas "^2.11.2" + path2d-polyfill "^2.0.1" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -2784,7 +3267,7 @@ postcss-selector-parser@^6.0.11: cssesc "^3.0.0" util-deprecate "^1.0.2" -postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: +postcss-value-parser@^4.0.0, postcss-value-parser@^4.0.2, postcss-value-parser@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== @@ -2798,6 +3281,15 @@ postcss@8.4.14: picocolors "^1.0.0" source-map-js "^1.0.2" +postcss@8.4.31: + version "8.4.31" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== + dependencies: + nanoid "^3.3.6" + picocolors "^1.0.0" + source-map-js "^1.0.2" + postcss@^8.4.21, postcss@^8.4.23: version "8.4.24" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.24.tgz#f714dba9b2284be3cc07dbd2fc57ee4dc972d2df" @@ -2812,7 +3304,12 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prop-types@^15.7.2, prop-types@^15.8.1: +printj@~1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/printj/-/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222" + integrity sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ== + +prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -3204,6 +3701,11 @@ rc-virtual-list@^3.5.1, rc-virtual-list@^3.5.2: rc-resize-observer "^1.0.0" rc-util "^5.15.0" +react-data-grid@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/react-data-grid/-/react-data-grid-5.0.5.tgz#529f5acd4750ae0461e9da66f9f30d6f597eed76" + integrity sha512-OR4LDoOpN4yj3NexaxYFS2OEIYFUk2V5lascPTHgtTMwwkb163tEPqQSertkv2YAJu+YBzIm8epW8+UMip1LPw== + react-dom@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" @@ -3217,6 +3719,20 @@ react-fast-compare@^3.0.1: resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49" integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== +react-file-viewer@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/react-file-viewer/-/react-file-viewer-1.2.1.tgz#051d29df7077fbf160b582e56ec25dab8e13bc7a" + integrity sha512-Hq9irsKkmXNGUOk7FBH/z/Lph4mpp3R4ySnGzhs3UEFVvHExuKhp9qPfoXUJjt/kQI5Qtrj1Y5r/fpDGkSrFyQ== + dependencies: + comma-separated-values "^3.6.4" + mammoth "1.3.6" + pdfjs-dist "1.8.357" + prop-types "^15.5.10" + react-data-grid "^5.0.5" + react-visibility-sensor "^5.0.2" + three "0.85.2" + xlsx "^0.10.1" + react-identicon@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/react-identicon/-/react-identicon-1.0.2.tgz#79ee46541e3665c873733b113496e71ea6a87264" @@ -3238,6 +3754,35 @@ react-is@^16.12.0, react-is@^16.13.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-pdf@7.5.0: + version "7.5.0" + resolved "https://registry.yarnpkg.com/react-pdf/-/react-pdf-7.5.0.tgz#a49d51faf2a68e0bc30d5a8ff5335061bb72a4b1" + integrity sha512-hX7SfQGd9T6pdd3H5HcR1VzrRCehkhnBh/tsyz9GO9cXrYHgoxupboVL2VCQpBBSak+/UQSMCj+3JTOdheuwwQ== + dependencies: + clsx "^2.0.0" + make-cancellable-promise "^1.3.1" + make-event-props "^1.6.0" + merge-refs "^1.2.1" + pdfjs-dist "3.11.174" + prop-types "^15.6.2" + tiny-invariant "^1.0.0" + tiny-warning "^1.0.0" + +react-pdf@^7.7.1: + version "7.7.1" + resolved "https://registry.yarnpkg.com/react-pdf/-/react-pdf-7.7.1.tgz#8f5c4716a8ca65a0889825ef01e3a37956291334" + integrity sha512-cbbf/PuRtGcPPw+HLhMI1f6NSka8OJgg+j/yPWTe95Owf0fK6gmVY7OXpTxMeh92O3T3K3EzfE0ML0eXPGwR5g== + dependencies: + clsx "^2.0.0" + dequal "^2.0.3" + make-cancellable-promise "^1.3.1" + make-event-props "^1.6.0" + merge-refs "^1.2.1" + pdfjs-dist "3.11.174" + prop-types "^15.6.2" + tiny-invariant "^1.0.0" + warning "^4.0.0" + react-player@^2.15.1: version "2.15.1" resolved "https://registry.yarnpkg.com/react-player/-/react-player-2.15.1.tgz#a5905126a6c5ba2667391a0d72da9f3a1ab57d54" @@ -3277,6 +3822,18 @@ react-router@6.13.0: dependencies: "@remix-run/router" "1.6.3" +react-simple-image-viewer@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/react-simple-image-viewer/-/react-simple-image-viewer-1.2.2.tgz#2a93413512b76ce8d336dd5fa19660a970d05be4" + integrity sha512-Vk9p6Glm7uE4cSEBGkqZPGC3qoZcAwd48nq5/JN13NKd9rUrUIWZWFEmRzO+FVwl6c0UdjSDkthGoaoiYeWVjg== + +react-visibility-sensor@^5.0.2: + version "5.1.1" + resolved "https://registry.yarnpkg.com/react-visibility-sensor/-/react-visibility-sensor-5.1.1.tgz#5238380960d3a0b2be0b7faddff38541e337f5a9" + integrity sha512-cTUHqIK+zDYpeK19rzW6zF9YfT4486TIgizZW53wEZ+/GPBbK7cNS0EHyJVyHYacwFEvvHLEKfgJndbemWhB/w== + dependencies: + prop-types "^15.7.2" + react@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" @@ -3291,6 +3848,15 @@ read-cache@^1.0.0: dependencies: pify "^2.3.0" +readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -3378,6 +3944,11 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + safe-regex-test@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" @@ -3387,6 +3958,11 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" +sax@~1.1.1: + version "1.1.6" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240" + integrity sha512-8zci48uUQyfqynGDSkUMD7FCJB96hwLnlZOXlgs1l3TX+LW27t3psSWKUxC0fxVgA86i8tL4NwGcY1h/6t3ESg== + scheduler@^0.23.0: version "0.23.0" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" @@ -3394,6 +3970,13 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" +schema-utils@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf" + integrity sha512-QaVYBaD9U8scJw2EBWnCBY+LJ0AD+/2edTaigDs0XLDLBfJmSUK9KGqktg1rb32U3z4j/XwvFwHHH1YfbYFd7Q== + dependencies: + ajv "^5.0.0" + scroll-into-view-if-needed@^3.0.3: version "3.0.10" resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.0.10.tgz#38fbfe770d490baff0fb2ba34ae3539f6ec44e13" @@ -3401,11 +3984,23 @@ scroll-into-view-if-needed@^3.0.3: dependencies: compute-scroll-into-view "^3.0.2" +semver@^6.0.0: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.3.5: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + semver@^7.3.7: version "7.5.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" @@ -3413,6 +4008,16 @@ semver@^7.3.7: dependencies: lru-cache "^6.0.0" +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== + +shallowequal@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" + integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -3462,11 +4067,25 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@^3.0.0, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.1.tgz#cc7ba77cfbe761036fbfce3d021af25fc5584d55" + integrity sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA== + dependencies: + decompress-response "^4.2.0" + once "^1.3.1" + simple-concat "^1.0.0" + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -3482,6 +4101,18 @@ source-map-js@^1.0.2: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +ssf@~0.10.0: + version "0.10.3" + resolved "https://registry.yarnpkg.com/ssf/-/ssf-0.10.3.tgz#8eae1fc29c90a552e7921208f81892d6f77acb2b" + integrity sha512-pRuUdW0WwyB2doSqqjWyzwCD6PkfxpHAHdZp39K3dp/Hq7f+xfMwNAWIi16DyrRg4gg9c/RvLYkJTSawTPTm1w== + dependencies: + frac "~1.1.2" + streamsearch@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" @@ -3492,6 +4123,15 @@ string-convert@^0.2.0: resolved "https://registry.yarnpkg.com/string-convert/-/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string.prototype.matchall@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz#3bf85722021816dcd1bf38bb714915887ca79fd3" @@ -3533,6 +4173,13 @@ string.prototype.trimstart@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -3560,6 +4207,21 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +styled-components@^6.0.8: + version "6.1.8" + resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-6.1.8.tgz#c109d36aeea52d8f049e12de2f3be39a6fc86201" + integrity sha512-PQ6Dn+QxlWyEGCKDS71NGsXoVLKfE1c3vApkvDYS5KAK+V8fNWGhbSUEo9Gg2iaID2tjLXegEW3bZDUGpofRWw== + dependencies: + "@emotion/is-prop-valid" "1.2.1" + "@emotion/unitless" "0.8.0" + "@types/stylis" "4.2.0" + css-to-react-native "3.2.0" + csstype "3.1.2" + postcss "8.4.31" + shallowequal "1.1.0" + stylis "4.3.1" + tslib "2.5.0" + styled-jsx@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.1.tgz#839a1c3aaacc4e735fed0781b8619ea5d0009d1f" @@ -3567,6 +4229,11 @@ styled-jsx@5.1.1: dependencies: client-only "0.0.1" +stylis@4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.1.tgz#ed8a9ebf9f76fe1e12d462f5cc3c4c980b23a7eb" + integrity sha512-EQepAV+wMsIaGVGX1RECzgrcqRRU/0sYOHkeLsZ3fzHaHXZy4DaOOX0vOlGQdlsjkh3mFHAIlVimpwAs4dslyQ== + stylis@^4.0.13: version "4.2.0" resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.2.0.tgz#79daee0208964c8fe695a42fcffcac633a211a51" @@ -3646,6 +4313,18 @@ tapable@^2.2.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== +tar@^6.1.11: + version "6.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" + integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^5.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + "tauri-plugin-sqlite-api@github:lzdyes/tauri-plugin-sqlite#v0.1.1": version "0.1.1" resolved "https://codeload.github.com/lzdyes/tauri-plugin-sqlite/tar.gz/3d09a5a963f96a06debe27b3e37d9337aca18dcc" @@ -3678,11 +4357,26 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" +three@0.85.2: + version "0.85.2" + resolved "https://registry.yarnpkg.com/three/-/three-0.85.2.tgz#8936f89c3668f7bf12f9b085ddf5dd409916ea27" + integrity sha512-7WdXWM+kk12xkNhbplmeKiujCmD+9ouvpbq4en1xrKvgIM8PX7j34EM2sjS72spf+KaMSqDYhX+ce3ZgvSZ1RQ== + throttle-debounce@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-5.0.0.tgz#a17a4039e82a2ed38a5e7268e4132d6960d41933" integrity sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg== +tiny-invariant@^1.0.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.3.tgz#46680b7a873a0d5d10005995eb90a70d74d60127" + integrity sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg== + +tiny-warning@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" + integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== + titleize@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" @@ -3705,6 +4399,11 @@ toggle-selection@^1.0.6: resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + ts-interface-checker@^0.1.9: version "0.1.13" resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" @@ -3720,6 +4419,11 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -3778,6 +4482,21 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +underscore@^1.13.1: + version "1.13.6" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" + integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== + +underscore@~1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8" + integrity sha512-z4o1fvKUojIWh9XuaVLUDdf86RQiq13AC1dmHbTpoyuu+bquHms76v16CjycCbec87J7z0k//SiQVk0sMdFmpQ== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + untildify@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" @@ -3798,7 +4517,7 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -util-deprecate@^1.0.2: +util-deprecate@^1.0.1, util-deprecate@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== @@ -3819,6 +4538,18 @@ vite@^4.0.0: optionalDependencies: fsevents "~2.3.2" +voc@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/voc/-/voc-1.0.0.tgz#5465c0ce11d0881f7d8e36d8ca587043f33a25ae" + integrity sha512-mQwxWlK+zosxxDTqiFb9ZQBNgd794scgkhVwca7h9sEhvA52f3VzbOK+TOWeS8eSrFXnfuKrxElSPc5oLAetfw== + +warning@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" + integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== + dependencies: + loose-envify "^1.0.0" + watchpack@2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" @@ -3827,6 +4558,19 @@ watchpack@2.4.0: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" @@ -3857,16 +4601,51 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +wide-align@^1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" + integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== + dependencies: + string-width "^1.0.2 || 2 || 3 || 4" + word-wrap@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +worker-loader@^0.8.0: + version "0.8.1" + resolved "https://registry.yarnpkg.com/worker-loader/-/worker-loader-0.8.1.tgz#e8e995331ea34df5bf68296824bfb7f0ad578d43" + integrity sha512-kEFCTNqlJvwOWCHCJeuOl/X2Np28cTKmY5CIpW/B23N2ndMno5Fswz7x/hvilutKoc4i5eedFf0BJ/3V/KPHaw== + dependencies: + loader-utils "^1.0.2" + schema-utils "^0.3.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +xlsx@^0.10.1: + version "0.10.9" + resolved "https://registry.yarnpkg.com/xlsx/-/xlsx-0.10.9.tgz#2c43d8c04ec2521d61955287246ea8defe19275f" + integrity sha512-XZrdkPmoZt8qPpVmuKNe7EYXyckvBArwFI7SMKiqdXz9ZAXRWx6EFMKpGTyiKklPzRsm2n4cmzADinPIlPi1Jg== + dependencies: + adler-32 "~1.1.0" + cfb "~0.12.0" + codepage "~1.10.1" + commander "~2.11.0" + crc-32 "~1.1.0" + exit-on-epipe "~1.0.1" + ssf "~0.10.0" + +xmlbuilder@~2.6.4: + version "2.6.5" + resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-2.6.5.tgz#6ff7ad60fb72d22764f007a164b77f2bf1400526" + integrity sha512-Ehby0RBBPAQAef3zP1636SPzwcfepVu69dmyCMkFioYOw/a6CULZbkRn8MCsVFzakt3+Zv23hecYdEsps9fRBQ== + dependencies: + lodash "^3.5.0" + yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" From bb14ef63b709bea866bedcfa97de502a8bb1247e Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 11:22:18 +0100 Subject: [PATCH 12/24] feat: add media codec --- src/components/thumbnail/index.tsx | 4 ++-- src/components/thumbnail/preview-media.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index ef3cf740..85af0dc9 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -40,10 +40,10 @@ export default function FileCard({ centered okButtonProps={{ hidden: true }} cancelButtonProps={{ hidden: true }} - width={500} + width={600} > <> -
+
diff --git a/src/components/thumbnail/preview-media.tsx b/src/components/thumbnail/preview-media.tsx index 1d1455df..19868727 100644 --- a/src/components/thumbnail/preview-media.tsx +++ b/src/components/thumbnail/preview-media.tsx @@ -27,6 +27,7 @@ export default function PreviewMedia({ fileType, filePath }: Props) { From 9612e8fa8d264f764c49e711f73a4a9fb282f9da Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 11:27:53 +0100 Subject: [PATCH 13/24] lint --- core/src/api/wifi.rs | 2 +- core/src/app_state.rs | 10 +--- core/src/fs/file.rs | 2 +- core/src/server/http_server.rs | 2 +- core/src/utils/fs.rs | 4 +- core/src/wifi/hotspot/windows.rs | 35 +++++++------- package.json | 4 -- src/components/MemoryInformation.tsx | 8 ---- yarn.lock | 69 +--------------------------- 9 files changed, 26 insertions(+), 110 deletions(-) diff --git a/core/src/api/wifi.rs b/core/src/api/wifi.rs index aee33971..4803807f 100644 --- a/core/src/api/wifi.rs +++ b/core/src/api/wifi.rs @@ -2,7 +2,7 @@ /// once this is done pass the network conf use crate::{ utils::CommandData, - wifi::{hotspot, network_scanner, WifiHotspotConfig}, + wifi::{network_scanner, WifiHotspotConfig}, }; #[tauri::command] diff --git a/core/src/app_state.rs b/core/src/app_state.rs index a66b961f..5a8b7487 100644 --- a/core/src/app_state.rs +++ b/core/src/app_state.rs @@ -2,6 +2,7 @@ #[allow(dead_code)] use crate::database::{Settings, TransferHistory}; +#[derive(Default)] pub struct State { pub settings: Settings, pub transfer_history: Vec, @@ -19,11 +20,4 @@ impl State { } } -impl Default for State { - fn default() -> Self { - Self { - settings: Settings::default(), - transfer_history: Vec::new(), - } - } -} + diff --git a/core/src/fs/file.rs b/core/src/fs/file.rs index 00606f32..e9f14b9a 100644 --- a/core/src/fs/file.rs +++ b/core/src/fs/file.rs @@ -64,7 +64,7 @@ impl File { .file_name() .unwrap() .to_str() - .map(|s| s.starts_with(".")) + .map(|s| s.starts_with('.')) .unwrap(); Self { diff --git a/core/src/server/http_server.rs b/core/src/server/http_server.rs index 82298422..e9e4a08a 100644 --- a/core/src/server/http_server.rs +++ b/core/src/server/http_server.rs @@ -9,7 +9,7 @@ use axum::extract::DefaultBodyLimit; use crate::database::Database; use crate::server::router; -use crate::server::routes::handle_404; + use crate::SERVER_PORT; /** diff --git a/core/src/utils/fs.rs b/core/src/utils/fs.rs index 6a3906b8..10bc31e3 100644 --- a/core/src/utils/fs.rs +++ b/core/src/utils/fs.rs @@ -1,5 +1,5 @@ -use std::process::Command; -use sysinfo::{DiskExt, System, SystemExt}; + +use sysinfo::{DiskExt, SystemExt}; // pub mod storage_information; /// a function to compute file size /// accept files size in byte and parse it to human readable KB, MB, TB, GB e.t.c diff --git a/core/src/wifi/hotspot/windows.rs b/core/src/wifi/hotspot/windows.rs index 359b18d3..5feb8820 100644 --- a/core/src/wifi/hotspot/windows.rs +++ b/core/src/wifi/hotspot/windows.rs @@ -2,7 +2,7 @@ use mockall::predicate::*; use mockall::*; use std::process::Command; fn command_output_to_string(output: &Vec) -> String { - let _output = std::str::from_utf8(&output); + let _output = std::str::from_utf8(output); match _output { Ok(s) => s.to_string(), Err(_) => "None".to_string(), @@ -41,9 +41,8 @@ fn create_ap_with_hotspotcommand(hotspotcommand: T, ssid: &st Ok(_) => println!("Started a new hotspot"), Err(e) => { println!("{}", e); - return; } - }; + } } /// Turnoff the hotspot @@ -84,7 +83,7 @@ impl HotSpotCommand for DefaultHotSpotCommand { Ok(false) } } - Err(_) => Err(format!("Failed to get the wlan drivers information")), + Err(_) => Err("Failed to get the wlan drivers information".to_string()), } } @@ -100,16 +99,16 @@ impl HotSpotCommand for DefaultHotSpotCommand { .output() { Ok(output) => { - if let true = output.status.success() { - return Ok(()); + if output.status.success() { + Ok(()) } else { - return Err(format!( + Err(format!( "Failed to create hotspot: {}", command_output_to_string(&output.stderr) - )); + )) } } - Err(_) => return Err(format!("Failed to execute create hotspot through netsh.")), + Err(_) => Err("Failed to execute create hotspot through netsh.".to_string()), } } @@ -121,12 +120,12 @@ impl HotSpotCommand for DefaultHotSpotCommand { Ok(output) => { if command_output_to_string(&output.stdout).contains("The hosted network started.") { - return Ok(()); + Ok(()) } else { - return Err(format!("Failed to start the hosted network")); + Err("Failed to start the hosted network".to_string()) } } - Err(_) => return Err(format!("Failed to start the hosted network through netsh")), + Err(_) => Err("Failed to start the hosted network through netsh".to_string()), } } @@ -137,12 +136,12 @@ impl HotSpotCommand for DefaultHotSpotCommand { { Ok(output) => { if command_output_to_string(&output.stdout).contains("The hosted network stoped.") { - return Ok(()); + Ok(()) } else { - return Err(format!("Failed to stop the hosted network")); + Err("Failed to stop the hosted network".to_string()) } } - Err(_) => return Err(format!("Failed to stop the hosted network through netsh")), + Err(_) => Err("Failed to stop the hosted network through netsh".to_string()), } } } @@ -212,7 +211,7 @@ mod tests { mock_hotspotcommand .expect_create_hotspot() .times(1) - .returning(|_, _| Err(format!("Failed"))) + .returning(|_, _| Err("Failed".to_string())) .in_sequence(&mut seq); mock_hotspotcommand.expect_start_hotspot().times(0); create_ap_with_hotspotcommand(mock_hotspotcommand, ssid, key); @@ -237,7 +236,7 @@ mod tests { mock_hotspotcommand .expect_start_hotspot() .times(1) - .returning(|| Err(format!("Failed"))) + .returning(|| Err("Failed".to_string())) .in_sequence(&mut seq); create_ap_with_hotspotcommand(mock_hotspotcommand, ssid, key); } @@ -259,7 +258,7 @@ mod tests { mock_hotspotcommand .expect_stop_hotspot() .times(1) - .returning(|| Err(format!("Failed"))); + .returning(|| Err("Failed".to_string())); turn_off_hotspot_with_hotspotcommand(mock_hotspotcommand); } } diff --git a/package.json b/package.json index 17c35c92..aeb72112 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "@headlessui/react": "^1.7.13", "@heroicons/react": "^2.0.16", "@tauri-apps/api": "^1.3.0", - "@types/viewerjs": "^1.0.2", "antd": "^5.6.2", "iqons": "^1.0.4", "next": "^13.2.4", @@ -28,11 +27,8 @@ "react-file-viewer": "^1.2.1", "react-identicon": "^1.0.2", "react-identicons": "^1.2.5", - "react-pdf": "^7.7.1", - "react-player": "^2.15.1", "react-qr-code": "^2.0.11", "react-router-dom": "^6.9.0", - "react-simple-image-viewer": "^1.2.2", "tauri-plugin-sqlite-api": "github:lzdyes/tauri-plugin-sqlite#v0.1.1", "tauri-plugin-store-api": "https://github.com/tauri-apps/tauri-plugin-store#v1", "viewerjs": "^1.11.6" diff --git a/src/components/MemoryInformation.tsx b/src/components/MemoryInformation.tsx index 9574a3c5..5005182a 100644 --- a/src/components/MemoryInformation.tsx +++ b/src/components/MemoryInformation.tsx @@ -10,9 +10,6 @@ export const MemoryInformation = ({ }) => { const freeMemory = Number(totalMemory?.split(" ")[0]) - Number(usedMemory?.split(" ")[0]); - // const memBarWidth = - // Math.round(freeMemory / Number(totalMemory?.split(" ")[0])) + "%"; - const memBarWidth = "56%"; return (
- {/* { - - {systemName} - - } */} {usedMemory} of {totalMemory} diff --git a/yarn.lock b/yarn.lock index 7c228cdc..91b78806 100644 --- a/yarn.lock +++ b/yarn.lock @@ -857,13 +857,6 @@ resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.2.0.tgz#199a3f473f0c3a6f6e4e1b17cdbc967f274bdc6b" integrity sha512-n4sx2bqL0mW1tvDf/loQ+aMX7GQD3lc3fkCMC55VFNDu/vBOabO+LTIeXKM14xK0ppk5TUGcWRjiSpIlUpghKw== -"@types/viewerjs@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/viewerjs/-/viewerjs-1.0.2.tgz#f4a5b1ff376c74bc89ff6652f072a6217a596f8a" - integrity sha512-IQj7e29b6gRpkXbj8H5l0TlHsrCQP+YasYozr85aLX4No4UJgvthHUYbzFkSPUZdcNEKRCIJY+7rR4DTfC0AQw== - dependencies: - viewerjs "*" - "@typescript-eslint/parser@^5.42.0": version "5.60.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.60.0.tgz#08f4daf5fc6548784513524f4f2f359cebb4068a" @@ -1544,11 +1537,6 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^4.0.0: - version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" - integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== - default-browser-id@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" @@ -2701,11 +2689,6 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -load-script@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/load-script/-/load-script-1.0.0.tgz#0491939e0bee5643ee494a7e3da3d2bac70c6ca4" - integrity sha512-kPEjMFtZvwL9TaZo0uZ2ml+Ye9HUMmPwbYRJ324qF9tqMejwykJ5ggTyvzmrbBeapCAbk98BSbTeovHEEP1uCA== - loader-utils@^1.0.2: version "1.4.2" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3" @@ -2732,7 +2715,7 @@ lodash@^3.5.0, lodash@^3.9.3: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -2800,11 +2783,6 @@ mammoth@1.3.6: underscore "~1.6.0" xmlbuilder "~2.6.4" -memoize-one@^5.1.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e" - integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q== - merge-refs@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/merge-refs/-/merge-refs-1.2.2.tgz#6142633398dd0d10a37626cae77ddeb1db26db0c" @@ -3714,11 +3692,6 @@ react-dom@^18.2.0: loose-envify "^1.1.0" scheduler "^0.23.0" -react-fast-compare@^3.0.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49" - integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== - react-file-viewer@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/react-file-viewer/-/react-file-viewer-1.2.1.tgz#051d29df7077fbf160b582e56ec25dab8e13bc7a" @@ -3768,32 +3741,6 @@ react-pdf@7.5.0: tiny-invariant "^1.0.0" tiny-warning "^1.0.0" -react-pdf@^7.7.1: - version "7.7.1" - resolved "https://registry.yarnpkg.com/react-pdf/-/react-pdf-7.7.1.tgz#8f5c4716a8ca65a0889825ef01e3a37956291334" - integrity sha512-cbbf/PuRtGcPPw+HLhMI1f6NSka8OJgg+j/yPWTe95Owf0fK6gmVY7OXpTxMeh92O3T3K3EzfE0ML0eXPGwR5g== - dependencies: - clsx "^2.0.0" - dequal "^2.0.3" - make-cancellable-promise "^1.3.1" - make-event-props "^1.6.0" - merge-refs "^1.2.1" - pdfjs-dist "3.11.174" - prop-types "^15.6.2" - tiny-invariant "^1.0.0" - warning "^4.0.0" - -react-player@^2.15.1: - version "2.15.1" - resolved "https://registry.yarnpkg.com/react-player/-/react-player-2.15.1.tgz#a5905126a6c5ba2667391a0d72da9f3a1ab57d54" - integrity sha512-ni1XFuYZuhIKKdeFII+KRLmIPcvCYlyXvtSMhNOgssdfnSovmakBtBTW2bxowPvmpKy5BTR4jC4CF79ucgHT+g== - dependencies: - deepmerge "^4.0.0" - load-script "^1.0.0" - memoize-one "^5.1.1" - prop-types "^15.7.2" - react-fast-compare "^3.0.1" - react-qr-code@^2.0.11: version "2.0.11" resolved "https://registry.yarnpkg.com/react-qr-code/-/react-qr-code-2.0.11.tgz#444c759a2100424972e17135fbe0e32eaffa19e8" @@ -3822,11 +3769,6 @@ react-router@6.13.0: dependencies: "@remix-run/router" "1.6.3" -react-simple-image-viewer@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/react-simple-image-viewer/-/react-simple-image-viewer-1.2.2.tgz#2a93413512b76ce8d336dd5fa19660a970d05be4" - integrity sha512-Vk9p6Glm7uE4cSEBGkqZPGC3qoZcAwd48nq5/JN13NKd9rUrUIWZWFEmRzO+FVwl6c0UdjSDkthGoaoiYeWVjg== - react-visibility-sensor@^5.0.2: version "5.1.1" resolved "https://registry.yarnpkg.com/react-visibility-sensor/-/react-visibility-sensor-5.1.1.tgz#5238380960d3a0b2be0b7faddff38541e337f5a9" @@ -4522,7 +4464,7 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -viewerjs@*, viewerjs@^1.11.6: +viewerjs@^1.11.6: version "1.11.6" resolved "https://registry.yarnpkg.com/viewerjs/-/viewerjs-1.11.6.tgz#19a1e78c15eba5a9fbbf34ebc5ab312d6e8932ed" integrity sha512-TlhdSp2oEOLFXvEp4psKaeTjR5zBjTRcM/sHUN8PkV1UWuY8HKC8n7GaVdW5Xqnwdr/F1OmzLik1QwDjI4w/nw== @@ -4543,13 +4485,6 @@ voc@~1.0.0: resolved "https://registry.yarnpkg.com/voc/-/voc-1.0.0.tgz#5465c0ce11d0881f7d8e36d8ca587043f33a25ae" integrity sha512-mQwxWlK+zosxxDTqiFb9ZQBNgd794scgkhVwca7h9sEhvA52f3VzbOK+TOWeS8eSrFXnfuKrxElSPc5oLAetfw== -warning@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" - integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== - dependencies: - loose-envify "^1.0.0" - watchpack@2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" From 7fcac150f9961d524ebb5e0a0b29df69c15cef2d Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 11:38:25 +0100 Subject: [PATCH 14/24] fixes: update import path --- src/components/history/FileTransferCard.tsx | 4 ++-- src/components/thumbnail/index.tsx | 5 ++++- src/pages/[...slug].tsx | 6 +++--- src/pages/quick-access/audio.tsx | 4 +--- src/pages/quick-access/desktop.tsx | 1 - src/pages/quick-access/documents.tsx | 1 - src/pages/quick-access/pictures.tsx | 1 - src/pages/quick-access/videos.tsx | 1 - 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/components/history/FileTransferCard.tsx b/src/components/history/FileTransferCard.tsx index 30a42199..a7159bce 100644 --- a/src/components/history/FileTransferCard.tsx +++ b/src/components/history/FileTransferCard.tsx @@ -10,7 +10,7 @@ import { PlayCircleIcon, } from "@heroicons/react/24/outline"; import Image from "next/image"; -import { getFileIcon } from "../thumbnail"; +import { getFileIcon } from "../thumbnail/media-icon-maker"; // the required data to render the file card component // the data will be passed dynamically @@ -71,7 +71,7 @@ function FileIcon({ fileType }: { fileType: string }) { return ( <> file card icon { @@ -65,7 +65,7 @@ export default function PreviewMediaPage() { }, [filePath, isFolder]); // typecast the response into AppData type - const fetchedFiles = data as unknown as AppData>; + const fetchedFiles = data as unknown as AppData>; // if it is a folder, get the files nd list them // get the data from the application core diff --git a/src/pages/quick-access/audio.tsx b/src/pages/quick-access/audio.tsx index 644735f3..e2104be6 100644 --- a/src/pages/quick-access/audio.tsx +++ b/src/pages/quick-access/audio.tsx @@ -63,9 +63,7 @@ export default function Music() { filePath={file.filePath} isHidden={file.isHidden} isFolder={file.isFolder} - action={() => { - console.log("play audio file"); - }} + /> ))}
diff --git a/src/pages/quick-access/desktop.tsx b/src/pages/quick-access/desktop.tsx index 8307baeb..e9253cca 100644 --- a/src/pages/quick-access/desktop.tsx +++ b/src/pages/quick-access/desktop.tsx @@ -52,7 +52,6 @@ export default function Document() { filePath={file.filePath} isHidden={file.isHidden} isFolder={file.isFolder} - action={() => shareFile(file.filePath)} /> ))}
diff --git a/src/pages/quick-access/documents.tsx b/src/pages/quick-access/documents.tsx index 348679f6..e2532426 100644 --- a/src/pages/quick-access/documents.tsx +++ b/src/pages/quick-access/documents.tsx @@ -51,7 +51,6 @@ export default function Document() { fileSize={file.fileSize} fileFormat={file.fileFormat} filePath={file.filePath} - action={() => shareFile(file.filePath)} isHidden={file.isHidden} isFolder={file.isFolder} /> diff --git a/src/pages/quick-access/pictures.tsx b/src/pages/quick-access/pictures.tsx index c010c16a..e4e270ad 100644 --- a/src/pages/quick-access/pictures.tsx +++ b/src/pages/quick-access/pictures.tsx @@ -53,7 +53,6 @@ export default function Images() { filePath={file.filePath} isHidden={file.isHidden} isFolder={file.isFolder} - action={() => shareFile(file.filePath)} /> ))}
diff --git a/src/pages/quick-access/videos.tsx b/src/pages/quick-access/videos.tsx index d91b0c0f..741c057d 100644 --- a/src/pages/quick-access/videos.tsx +++ b/src/pages/quick-access/videos.tsx @@ -52,7 +52,6 @@ export default function Video() { filePath={file.filePath} isHidden={file.isHidden} isFolder={file.isFolder} - action={() => shareFile(file.filePath)} /> ))}
From 18fa789b10dc7db58acc819e1b22d1a27789613d Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 12:03:15 +0100 Subject: [PATCH 15/24] refactor --- react-file-viewer.d.ts | 2 +- src/components/thumbnail/index.tsx | 4 +-- src/components/thumbnail/preview-media.tsx | 17 +++++++------ src/pages/[...slug].tsx | 29 ---------------------- src/pages/quick-access/audio.tsx | 14 +---------- src/pages/quick-access/desktop.tsx | 3 +-- src/pages/quick-access/documents.tsx | 5 +--- src/pages/quick-access/pictures.tsx | 4 +-- src/pages/quick-access/videos.tsx | 9 +++---- 9 files changed, 21 insertions(+), 66 deletions(-) diff --git a/react-file-viewer.d.ts b/react-file-viewer.d.ts index 8db23f9b..a22c6024 100644 --- a/react-file-viewer.d.ts +++ b/react-file-viewer.d.ts @@ -1 +1 @@ -declare module "react-file-viewer"; \ No newline at end of file +declare module "react-file-viewer"; diff --git a/src/components/thumbnail/index.tsx b/src/components/thumbnail/index.tsx index bb75cc60..7f312a9d 100644 --- a/src/components/thumbnail/index.tsx +++ b/src/components/thumbnail/index.tsx @@ -1,13 +1,13 @@ "use client"; import { computeFileSize } from "@/utils"; -import Modal from "antd/es/modal/Modal"; import { useRouter } from "next/router"; import { useState } from "react"; import { File } from "../../../core/bindings/File"; -import PreviewMedia, { FileType } from "./preview-media"; +import PreviewMedia from "./preview-media"; import { getFileIcon } from "./media-icon-maker"; import ThumbnailIcon from "./icon-renderer"; +import { Modal } from "antd"; export default function FileCard({ fileName, diff --git a/src/components/thumbnail/preview-media.tsx b/src/components/thumbnail/preview-media.tsx index 19868727..1f5b35f2 100644 --- a/src/components/thumbnail/preview-media.tsx +++ b/src/components/thumbnail/preview-media.tsx @@ -3,6 +3,8 @@ /// give preview for differet file type import FileViewer from "react-file-viewer"; +const isClient = typeof window !== "undefined"; + export enum FileType { Image = "image", Audio = "audio", @@ -23,13 +25,14 @@ interface Props { } export default function PreviewMedia({ fileType, filePath }: Props) { + const fileUrl = isClient ? `${process.env.NEXT_PUBLIC_API_URL}/file/${filePath}` : ""; + return ( - +
+ +
); } diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index cce4a053..f00d2807 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -8,33 +8,9 @@ import { AppData } from "@/types"; import { invoke } from "@tauri-apps/api"; import LoaderCircle from "@/components/loaders/LoaderCircle"; import QuickAccessLayout from "@/components/layout/PageLayout"; -import { WebviewWindow } from "@tauri-apps/api/window"; import {File} from "../../core/bindings/File" - const createWebView = () => { - // if it is known filetype or a broken file, in as much as it n ot a folder,try to render it - const webview = new WebviewWindow("google", { - url: "https://google.com", - }); - - webview.once("tauri://created", function () { - // webview window successfully created - }); - - webview.once("tauri://error", function (e) { - // an error happened creating the webview window - console.log("an error occured while opening the window due to ", e); - }); - - // console.log("window successfully created"); - // webview.setAlwaysOnTop(true); - // webview.center(); - // webview.requestUserAttention; - // webview.isDecorated(); - // webview.setFocus(); - }; - export default function PreviewMediaPage() { const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); @@ -81,11 +57,6 @@ export default function PreviewMediaPage() { ); } - - if (!isFolder){ - createWebView(); - return - } // render them if (data) { return ( diff --git a/src/pages/quick-access/audio.tsx b/src/pages/quick-access/audio.tsx index e2104be6..3ede0f53 100644 --- a/src/pages/quick-access/audio.tsx +++ b/src/pages/quick-access/audio.tsx @@ -6,17 +6,7 @@ import { useEffect, useState } from "react"; import LoaderCircle from "@/components/loaders/LoaderCircle"; export default function Music() { - // display a module to play music - function playMusic(filePath: string) { - const assetUrl = convertFileSrc(filePath); - const audio = document.getElementById("testNode") as HTMLAudioElement; - const source = document.createElement("source"); - source.type = "audio/mp3"; - source.src = assetUrl; - audio?.appendChild(source); - audio?.load(); - console.log("playing ", filePath); - } + const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); @@ -30,8 +20,6 @@ export default function Music() { setLoading(false); }); }, []); - // TODO(@opeolluwa): use Tauri Js API to render musicData - // TODO(@opeolluwa) add modal to play audio file, audio and document using web APIs // typecast the response into AppData type const musicData = data as unknown as AppData>; if (isLoading) { diff --git a/src/pages/quick-access/desktop.tsx b/src/pages/quick-access/desktop.tsx index e9253cca..c7a738ae 100644 --- a/src/pages/quick-access/desktop.tsx +++ b/src/pages/quick-access/desktop.tsx @@ -1,9 +1,8 @@ import FileCard, { FileInterface } from "@/components/thumbnail"; import QuickAccessLayout from "@/components/layout/PageLayout"; -import { AppData, AudioFile } from "@/types"; +import { AppData} from "@/types"; import { invoke } from "@tauri-apps/api/tauri"; import { useEffect, useState } from "react"; -import { shareFile } from "@/utils"; import LoaderCircle from "@/components/loaders/LoaderCircle"; diff --git a/src/pages/quick-access/documents.tsx b/src/pages/quick-access/documents.tsx index e2532426..8a8c7352 100644 --- a/src/pages/quick-access/documents.tsx +++ b/src/pages/quick-access/documents.tsx @@ -1,13 +1,10 @@ import FileCard, { FileInterface } from "@/components/thumbnail"; import QuickAccessLayout from "@/components/layout/PageLayout"; -import { AppData, AudioFile } from "@/types"; +import { AppData} from "@/types"; import { invoke } from "@tauri-apps/api/tauri"; import { useEffect, useState } from "react"; -import { shareFile } from "@/utils"; import LoaderCircle from "@/components/loaders/LoaderCircle"; -import { Dir } from "../../../core/bindings/Dir"; -const isClient = typeof window !== "undefined"; export default function Document() { const [data, setData] = useState(null); diff --git a/src/pages/quick-access/pictures.tsx b/src/pages/quick-access/pictures.tsx index e4e270ad..df8924a2 100644 --- a/src/pages/quick-access/pictures.tsx +++ b/src/pages/quick-access/pictures.tsx @@ -1,12 +1,10 @@ import FileCard, { FileInterface } from "@/components/thumbnail"; import QuickAccessLayout from "@/components/layout/PageLayout"; -import { AppData, AudioFile } from "@/types"; +import { AppData} from "@/types"; import { invoke } from "@tauri-apps/api/tauri"; import { useEffect, useState } from "react"; -import { shareFile } from "@/utils"; import LoaderCircle from "@/components/loaders/LoaderCircle"; -const isClient = typeof window !== "undefined"; export default function Images() { const [data, setData] = useState(null); diff --git a/src/pages/quick-access/videos.tsx b/src/pages/quick-access/videos.tsx index 741c057d..7fd40af7 100644 --- a/src/pages/quick-access/videos.tsx +++ b/src/pages/quick-access/videos.tsx @@ -1,13 +1,12 @@ +"is client"; + import FileCard, { FileInterface } from "@/components/thumbnail"; import QuickAccessLayout from "@/components/layout/PageLayout"; -import { AppData, AudioFile } from "@/types"; +import { AppData } from "@/types"; import { invoke } from "@tauri-apps/api/tauri"; import { useEffect, useState } from "react"; -import { shareFile } from "@/utils"; import LoaderCircle from "@/components/loaders/LoaderCircle"; -import path from "path"; -const isClient = typeof window !== "undefined"; export default function Video() { const [data, setData] = useState(null); @@ -16,7 +15,7 @@ export default function Video() { // get the data from the application core useEffect(() => { setLoading(true); - invoke("read_dir", {path:"videos"}).then((res) => { + invoke("read_dir", { path: "videos" }).then((res) => { setData(res as any); setLoading(false); }); From e51b8dd8d3c43bb5162a12f9d9d9cbef218b5387 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 17:35:50 +0100 Subject: [PATCH 16/24] feaat: add loging to the server --- core/Cargo.toml | 2 +- core/src/main.rs | 13 +++++---- core/src/server/http_server.rs | 10 +++---- core/src/server/router.rs | 4 ++- core/src/server/routes.rs | 49 +++++++++++++++++++++++++++++----- 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index 8773725b..8184b8f6 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -14,7 +14,7 @@ tauri-build = {version = "1.3", features = [] } [dependencies] assert_fs = "1.0.13" -axum = {version = "0.6.12", features = ["multipart", "headers"] } +axum = { version = "0.6.12", features = ["multipart", "headers"] } battery = "0.7.8" chrono = "0.4.31" dirs = "5.0.0" diff --git a/core/src/main.rs b/core/src/main.rs index 75a16a59..94b1ad8a 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -3,6 +3,7 @@ extern crate uptime_lib; +use crate::api::fs_api::get_transfer_history; /** * the application is structured thus * src @@ -11,10 +12,7 @@ extern crate uptime_lib; * __fs * ... */ - - -use crate::api::fs_api::read_dir; -use crate::api::fs_api::get_transfer_history; +use crate::api::fs_api::read_dir; // Import individual items from crate::api::settings use crate::api::settings::{get_settings, update_settings}; @@ -45,8 +43,8 @@ lazy_static! { * * Herein the server port made globally available, this allow for ease of sharing same with file upload directory */ - pub static ref SERVER_PORT: u16 = - portpicker::pick_unused_port().expect("failed to get an unused port"); + pub static ref SERVER_PORT: u16 = 18005; + // portpicker::pick_unused_port().expect("failed to get an unused port"); pub static ref UPLOAD_DIRECTORY: std::string::String = String::from("filesync"); /* create a database in the home dir and / save files to $HOME/filesync/.dat */ @@ -86,7 +84,6 @@ fn main() -> Result<(), tauri::Error> { ..Default::default() }; - scan_wifi(); // run core the server in a separate thread from tauri tauri::async_runtime::spawn(http_server::core_server()); // run the UI code and the IPC (internal Procedure Call functions) @@ -105,4 +102,6 @@ fn main() -> Result<(), tauri::Error> { scan_wifi // download_file, TODO: implement file transfering between peers ]) .run(tauri::generate_context!()) + + // Ok(()) } diff --git a/core/src/server/http_server.rs b/core/src/server/http_server.rs index e9e4a08a..836d2476 100644 --- a/core/src/server/http_server.rs +++ b/core/src/server/http_server.rs @@ -10,6 +10,7 @@ use axum::extract::DefaultBodyLimit; use crate::database::Database; use crate::server::router; +use crate::server::routes::handle_404; use crate::SERVER_PORT; /** @@ -52,17 +53,14 @@ pub async fn core_server() { .parse::() .expect("invalid socket address"); - tracing::debug!("server running on http://{}", &ip_address.to_string()); + println!(" the server port is http://{}", ip_address); // build our application with the required routes let app = router::app() .layer(file_limit) .layer(cors_layer) - .layer(tower_http::trace::TraceLayer::new_for_http()); - // .fallback(handle_404); - - // add a fallback service for handling routes to unknown paths - // let app = app.fallback(handle_404); + .layer(tower_http::trace::TraceLayer::new_for_http()) + .fallback(handle_404); // run the server axum::Server::bind(&ip_address) diff --git a/core/src/server/router.rs b/core/src/server/router.rs index 48421fc7..8271882f 100644 --- a/core/src/server/router.rs +++ b/core/src/server/router.rs @@ -6,13 +6,15 @@ use axum::{ }; use super::routes::{ - accept_file_upload, download_file, file_upload_form, get_file, system_information, + accept_file_upload, download_file, file_upload_form, get_file, health_check, ping_server, system_information }; // the app is moved here to allow sharing across test modules pub fn app() -> Router { Router::new() + .route("/", get(ping_server)) .route("/upload", post(accept_file_upload).get(file_upload_form)) + .route("/health", post(accept_file_upload).get(health_check)) .route("/api/sys-info", get(system_information)) .route("/api/download", get(download_file)) .route("/api/file", get(get_file)) diff --git a/core/src/server/routes.rs b/core/src/server/routes.rs index 67529fde..4f4cc4b7 100644 --- a/core/src/server/routes.rs +++ b/core/src/server/routes.rs @@ -20,12 +20,12 @@ use crate::UPLOAD_DIRECTORY; #[derive(Debug, Serialize, Deserialize)] /// destructure query parameter -pub struct Params { +pub struct QueryParams { pub file_path: String, } /// accept file path amd return the file -pub async fn download_file(Query(params): Query) -> impl IntoResponse { - let Params { file_path } = params; +pub async fn download_file(Query(params): Query) -> impl IntoResponse { + let QueryParams { file_path } = params; let Some(file) = tokio::fs::File::open(file_path).await.ok() else { return Err(( @@ -64,7 +64,7 @@ pub async fn system_information() -> (StatusCode, Json Html<&'static str> { Html( r#" @@ -235,9 +235,46 @@ pub async fn handle_404() -> impl IntoResponse { ) } + +/// health check handler +pub async fn health_check() -> impl IntoResponse { + ( + StatusCode::OK, + axum::response::Json(serde_json::json!({ + "success":true, + "message":String::from("Server is ready to accept connection"), + })), + ) +} + +/// ping the server +pub async fn ping_server() -> impl IntoResponse { + "FileSync Server 1.0.0" +} + + + /// for a given file path, return the file the the used as a downloadable one -pub async fn get_file() { - unimplemented!() +pub async fn get_file(Query(QueryParams { file_path }): Query) -> impl IntoResponse { + // `File` implements `AsyncRead` + let file = match tokio::fs::File::open(file_path).await { + Ok(file) => file, + Err(err) => return Err((StatusCode::NOT_FOUND, format!("File not found: {}", err))), + }; + // convert the `AsyncRead` into a `Stream` + let stream = ReaderStream::new(file); + // convert the `Stream` into an `axum::body::HttpBody` + let body = StreamBody::new(stream); + + let headers =[ + (header::CONTENT_TYPE, "text/toml; charset=utf-8"), + ( + header::CONTENT_DISPOSITION, + "attachment; filename=\"Cargo.toml\"", + ), + ]; + + Ok((headers, body)) } #[cfg(test)] From 3330841748ed8367c441e83abbe83db20859597b Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Tue, 9 Apr 2024 17:49:55 +0100 Subject: [PATCH 17/24] feat: add static file server --- package.json | 1 + src/components/thumbnail/preview-media.tsx | 2 +- yarn.lock | 57 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index aeb72112..3ea72869 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@heroicons/react": "^2.0.16", "@tauri-apps/api": "^1.3.0", "antd": "^5.6.2", + "axios": "^1.6.8", "iqons": "^1.0.4", "next": "^13.2.4", "react": "^18.2.0", diff --git a/src/components/thumbnail/preview-media.tsx b/src/components/thumbnail/preview-media.tsx index 1f5b35f2..6a508de7 100644 --- a/src/components/thumbnail/preview-media.tsx +++ b/src/components/thumbnail/preview-media.tsx @@ -25,7 +25,7 @@ interface Props { } export default function PreviewMedia({ fileType, filePath }: Props) { - const fileUrl = isClient ? `${process.env.NEXT_PUBLIC_API_URL}/file/${filePath}` : ""; + const fileUrl = isClient ? `http://192.168.0.170:18005/api/file?file_path=${filePath}` : ""; return (
diff --git a/yarn.lock b/yarn.lock index 91b78806..9d6c77a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1163,6 +1163,11 @@ async-validator@^4.1.0: resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339" integrity sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg== +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + autoprefixer@^10.4.14: version "10.4.14" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.14.tgz#e28d49902f8e759dd25b153264e862df2705f79d" @@ -1185,6 +1190,15 @@ axe-core@^4.6.2: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.2.tgz#040a7342b20765cb18bb50b628394c21bccc17a0" integrity sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g== +axios@^1.6.8: + version "1.6.8" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66" + integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + axobject-query@^3.1.1: version "3.2.1" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.2.1.tgz#39c378a6e3b06ca679f29138151e45b2b32da62a" @@ -1413,6 +1427,13 @@ color-support@^1.1.2: resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + comma-separated-values@^3.6.4: version "3.6.4" resolved "https://registry.yarnpkg.com/comma-separated-values/-/comma-separated-values-3.6.4.tgz#c309ec7024f74b7ae19223372054242617e35bd2" @@ -1568,6 +1589,11 @@ define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" @@ -2076,6 +2102,11 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== +follow-redirects@^1.15.6: + version "1.15.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" + integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -2083,6 +2114,15 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + frac@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/frac/-/frac-1.1.2.tgz#3d74f7f6478c88a1b5020306d747dc6313c74d0b" @@ -2806,6 +2846,18 @@ micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.2" picomatch "^2.3.1" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -3296,6 +3348,11 @@ prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: object-assign "^4.1.1" react-is "^16.13.1" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + punycode@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" From c3f1c99c2e13cfbc7fd0f87008af4ceb482cd8ec Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Fri, 12 Apr 2024 00:40:03 +0100 Subject: [PATCH 18/24] chore: add react context --- src/components/thumbnail/preview-media.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/thumbnail/preview-media.tsx b/src/components/thumbnail/preview-media.tsx index 6a508de7..151fd166 100644 --- a/src/components/thumbnail/preview-media.tsx +++ b/src/components/thumbnail/preview-media.tsx @@ -1,5 +1,7 @@ "use client"; +import { SystemInformationContext } from "@/store/sys-info"; +import { useContext } from "react"; /// give preview for differet file type import FileViewer from "react-file-viewer"; @@ -25,14 +27,15 @@ interface Props { } export default function PreviewMedia({ fileType, filePath }: Props) { - const fileUrl = isClient ? `http://192.168.0.170:18005/api/file?file_path=${filePath}` : ""; + const { serverBaseUrl } = useContext(SystemInformationContext); + + const fileUrl = isClient + ? `${serverBaseUrl}/api/file?file_path=${filePath}` + : ""; return (
- +
); } From 49b1c7bf265cf11f0247141fe23c64e038724b4b Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Thu, 2 May 2024 10:28:31 +0100 Subject: [PATCH 19/24] chore: add store context --- src/store/context.tsx | 4 ++-- src/store/wifi-status.tsx | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/store/wifi-status.tsx diff --git a/src/store/context.tsx b/src/store/context.tsx index 271a08fd..dae3d286 100644 --- a/src/store/context.tsx +++ b/src/store/context.tsx @@ -1,11 +1,11 @@ import { ReactNode, createContext, useState } from "react"; -interface TFileData { +interface TFileData { size: number; type: string; name: string; status: FileTransferStatus; -}; +} export enum FileTransferStatus { DOWNLOADING = "downloading", diff --git a/src/store/wifi-status.tsx b/src/store/wifi-status.tsx new file mode 100644 index 00000000..c0f6dec3 --- /dev/null +++ b/src/store/wifi-status.tsx @@ -0,0 +1,32 @@ +import { invoke } from "@tauri-apps/api/tauri"; +import { ReactNode, createContext, useEffect, useState } from "react"; +import { CommandData } from "../../core/bindings/CommandData"; + +type WifiStatusInterface = CommandData; + +export const WifiStatusContext = createContext({} as WifiStatusInterface); + +export default function WifiStatus({ children }: { children: ReactNode }) { + const [isConnectedToWifi, setConnectedToWifi] = useState(null); + + useEffect(() => { + invoke("is_connected_to_wifi").then((res) => { + setConnectedToWifi(res as any); + }); + }, []); + + // typecast the wifi response too + const wifiStatus = isConnectedToWifi as unknown as CommandData; + + return ( + + {children} + + ); +} From dd96a65a6e42513be0a0e74cd3e97adaf832d088 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Thu, 2 May 2024 10:29:10 +0100 Subject: [PATCH 20/24] refactor: add global wifi status context effect --- .../nav/{NavigationTab.tsx => NavItem.tsx} | 31 ++++++++- src/components/nav/QrConnect.tsx | 25 ------- src/components/nav/index.tsx | 65 +++++-------------- 3 files changed, 44 insertions(+), 77 deletions(-) rename src/components/nav/{NavigationTab.tsx => NavItem.tsx} (52%) delete mode 100644 src/components/nav/QrConnect.tsx diff --git a/src/components/nav/NavigationTab.tsx b/src/components/nav/NavItem.tsx similarity index 52% rename from src/components/nav/NavigationTab.tsx rename to src/components/nav/NavItem.tsx index 97b03a89..292983fd 100644 --- a/src/components/nav/NavigationTab.tsx +++ b/src/components/nav/NavItem.tsx @@ -8,6 +8,7 @@ export interface Route { action?: () => any; // action that will be executed when the route is clicked path: string; // the path string isActive?: any; + disabled?: boolean; } export default function NavigationTab({ @@ -16,16 +17,40 @@ export default function NavigationTab({ action, path, name, + disabled, }: Route) { const [currentIcon, setIcon] = useState(icon); const router = useRouter(); + + if (disabled) { + return ( +
+
+ + {path} +
+ {router.pathname == path.trim() ? alternateIcon : currentIcon} + {name} +
+
+
+
+ ); + } + return (
setIcon(icon)} onMouseEnter={() => setIcon(alternateIcon)} onClick={() => setIcon(alternateIcon)} diff --git a/src/components/nav/QrConnect.tsx b/src/components/nav/QrConnect.tsx deleted file mode 100644 index 2e63404e..00000000 --- a/src/components/nav/QrConnect.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import QRCode from "react-qr-code"; - -/** - * @function QRConnect - display QR code in which URL for connection is embedded - * @param url - the core application URl - * @param serverId, the serverId the application - * @return UI - */ -export default function QRConnect({ url }: { url: string }) { - return ( - <> -
- - {url} -
- - ); -} diff --git a/src/components/nav/index.tsx b/src/components/nav/index.tsx index f8538f10..66f50c34 100644 --- a/src/components/nav/index.tsx +++ b/src/components/nav/index.tsx @@ -9,66 +9,36 @@ import { } from "@heroicons/react/24/outline"; import { ClockIcon as SolidClockIcon, - Cog8ToothIcon as SolidCog8ToothIcon, - FolderOpenIcon as SolidFolderIconOpen, - HomeIcon as SolidHomeIcon, + Cog8ToothIcon as SolidCog8ToothIcon, HomeIcon as SolidHomeIcon, InformationCircleIcon as SolidInformationIcon, ShareIcon as SolidShareIcon, - SignalIcon as SolidSignalIcon, + SignalIcon as SolidSignalIcon } from "@heroicons/react/24/solid"; -import { goToPage as gotoPage } from "@/utils"; -import NavigationTab, { Route } from "./NavigationTab"; -import { useEffect, useState } from "react"; -import { SystemInformation } from "@/store/sys-info"; -import { invoke } from "@tauri-apps/api/tauri"; +import NavigationTab, { Route } from "./NavItem"; +import { useContext } from "react"; +import { + SystemInformationContext +} from "@/store/sys-info"; import { MemoryInformation } from "../MemoryInformation"; -import { message } from "@tauri-apps/api/dialog"; -import { open } from "@tauri-apps/api/dialog"; +import { WifiStatusContext } from "@/store/wifi-status"; + export default function Navigation() { - /** - * @function openFileManager - opens a file manager - * @returns {Array} an array of selected files - */ - const openFileManager = async () => /* : Array */ { - try { - const selectedFilePath = await open({ - directory: false, - multiple: true, - // filters: allowedExtension, - // defaultPath: await pictureDir(), - }); - // upload select file with tauri upload plugin - } catch (err) { - message((err as Error).message, { - title: "Access error", - type: "error", - }); - } - }; - let [systemInformation, setSystemInformation] = useState( - {} as SystemInformation + const { data: isConnectedToWifi } = useContext(WifiStatusContext); + const { availableDisk, usedDisk, systemName } = useContext( + SystemInformationContext ); - useEffect(() => { - // fetch sys information from app core - invoke("get_system_information").then((sysInfo) => { - setSystemInformation((sysInfo as any).data); - }); - }, []); - const routes: Route[] = [ { path: "/", icon: , name: "home", alternateIcon: , - action: () => gotoPage({ routePath: "/" }), }, { icon: , name: "Connect Device", alternateIcon: , - action: () => gotoPage({ routePath: "/connection" }), path: "/connection", }, { @@ -76,28 +46,24 @@ export default function Navigation() { icon: , name: "Share files", alternateIcon: , - action: () => gotoPage({ routePath: "share" }), }, { path: "/history", icon: , name: "Transfer History", alternateIcon: , - action: () => gotoPage({ routePath: "history" }), }, { path: "/settings", icon: , alternateIcon: , - action: () => gotoPage({ routePath: "settings" }), name: "settings", }, { path: "/about", icon: , alternateIcon: , - action: () => gotoPage({ routePath: "about" }), name: "About", }, ]; @@ -121,14 +87,15 @@ export default function Navigation() { action={route.action} alternateIcon={route.alternateIcon} path={route.path} + disabled={Boolean(isConnectedToWifi)} /> ))}
From 7b1520d844a0856ff2856e6dd29ac1e07b9d4f13 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Thu, 2 May 2024 10:29:32 +0100 Subject: [PATCH 21/24] refactor: add support for wifi status --- src/pages/_app.tsx | 10 ++- src/pages/connection.tsx | 5 +- src/pages/index.tsx | 83 ++++++++++++++++--- .../{desktop.tsx => downloads.tsx} | 0 4 files changed, 79 insertions(+), 19 deletions(-) rename src/pages/quick-access/{desktop.tsx => downloads.tsx} (100%) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index db214f5f..d7e240dc 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -3,14 +3,18 @@ import FileStore from "@/store/context"; import SystemInfoStore from "@/store/sys-info"; import "@/styles/globals.css"; import type { AppProps } from "next/app"; +import WifiStatus from "@/store/wifi-status"; + export default function App({ Component, pageProps }: AppProps) { return ( - - - + + + + + ); diff --git a/src/pages/connection.tsx b/src/pages/connection.tsx index af2ecdf8..f5f463a3 100644 --- a/src/pages/connection.tsx +++ b/src/pages/connection.tsx @@ -1,8 +1,7 @@ -import PageTitle from "@/components/PageTitle"; import Heading from "@/components/Heading"; import Text from "@/components/Text"; import PageLayout from "@/components/layout/PageLayout"; -import { Switch, Modal, Button } from "antd"; +import { Button, Modal, Switch } from "antd"; import { useState } from "react"; export default function ConnectionPage() { const [isModalOpen, setIsModalOpen] = useState(false); @@ -28,7 +27,7 @@ export default function ConnectionPage() { <> <> -
+
+ ), }, ]; @@ -69,20 +73,47 @@ const quickAccessTabs: QuickAccessTab[] = [ export default function Main() { const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); + const { data: isConnectedToWifi } = useContext(WifiStatusContext); + +//close the application + async function close() { + const yes = await ask( + "Current file transfer may be lost. Do you still want to proceed?", + { title: "Close", type: "warning" } + ); + if (yes) { + await exit(1).then(()=>{ + console.log("exited") + }).catch(error => { + console.log("exited"); + }); + } + } + + // refresh the application + async function refresh() { + await relaunch().then(()=>{ + console.log("refreshed") + }).catch(error => { + console.log("refreshed"); + + }); + } - // get the data from the application core useEffect(() => { setLoading(true); invoke("get_transfer_history").then((res) => { setData(res as any); - setLoading(false); }); + // when the data has ben fetched, stop the loading process + setLoading(false); }, []); // typecast the response into AppData type const transferHistory = data as unknown as CommandData< Array >; + if (isLoading) { return ( <> @@ -92,11 +123,37 @@ export default function Main() { ); } + + // if done loading and not connected to wifi + if (!isLoading && isConnectedToWifi === true) { + return ( + <> +
+
+ +
+ +

+ You should see your system files as soon as you are connected to a + WiFi network +

+
+ + +
+
+ + ); + } return ( <>
Date: Thu, 2 May 2024 10:30:34 +0100 Subject: [PATCH 22/24] refactor: add more loaders --- src/components/loaders/LoaderCircle.tsx | 4 +- src/components/loaders/LoaderDevices.tsx | 133 ------------------ src/components/loaders/LoaderSpaceShuttle.tsx | 102 -------------- src/components/loaders/LoaderWifi.tsx | 40 ++++++ 4 files changed, 42 insertions(+), 237 deletions(-) delete mode 100644 src/components/loaders/LoaderDevices.tsx delete mode 100644 src/components/loaders/LoaderSpaceShuttle.tsx create mode 100644 src/components/loaders/LoaderWifi.tsx diff --git a/src/components/loaders/LoaderCircle.tsx b/src/components/loaders/LoaderCircle.tsx index c8f92d7a..a308ba6e 100644 --- a/src/components/loaders/LoaderCircle.tsx +++ b/src/components/loaders/LoaderCircle.tsx @@ -1,4 +1,4 @@ -function HelloWorld() { +function Loader() { return ( <> @@ -43,4 +43,4 @@ function HelloWorld() { ); } -export default HelloWorld; +export default Loader; diff --git a/src/components/loaders/LoaderDevices.tsx b/src/components/loaders/LoaderDevices.tsx deleted file mode 100644 index aa9f3ec6..00000000 --- a/src/components/loaders/LoaderDevices.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import React from "react"; - -export default function LoaderDevices() { - return ( - <> -
-
-
-
-
- - - - ); -} diff --git a/src/components/loaders/LoaderSpaceShuttle.tsx b/src/components/loaders/LoaderSpaceShuttle.tsx deleted file mode 100644 index 756afb7e..00000000 --- a/src/components/loaders/LoaderSpaceShuttle.tsx +++ /dev/null @@ -1,102 +0,0 @@ -export default function LoaderSpaceShuttle() { - return ( - <> - - - - ); -} diff --git a/src/components/loaders/LoaderWifi.tsx b/src/components/loaders/LoaderWifi.tsx new file mode 100644 index 00000000..1b8d9b05 --- /dev/null +++ b/src/components/loaders/LoaderWifi.tsx @@ -0,0 +1,40 @@ +function Loader() { + return ( + <> + + + + ); +} + +export default Loader; From 1a353ad0837c8c7b80e9cd6944c5f04a14b09c4c Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Thu, 2 May 2024 10:30:53 +0100 Subject: [PATCH 23/24] chore --- core/src/api/utils.rs | 14 ++++++++++++++ core/src/main.rs | 5 ++++- src/components/MemoryInformation.tsx | 12 ++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/src/api/utils.rs b/core/src/api/utils.rs index cda261c9..7d39ad9e 100644 --- a/core/src/api/utils.rs +++ b/core/src/api/utils.rs @@ -1,4 +1,5 @@ use std::net::Ipv4Addr; +use local_ip_address::local_ip; use crate::{ utils::{system_info::SystemInformation, CommandData}, @@ -33,3 +34,16 @@ pub fn get_ip_address() -> String { pub fn get_system_information() -> CommandData { CommandData::ok("connected system information ", SystemInformation::new()) } + + + +#[tauri::command] +pub fn is_connected_to_wifi() -> CommandData { + // the app would have a local ip address if it is connected to a network + // else it would crash, this is leveraged to check the network status + let has_ip_addr = local_ip().ok(); + if has_ip_addr.is_none() { + return CommandData::ok("wifi status", false); + } + CommandData::ok("server address", true) +} \ No newline at end of file diff --git a/core/src/main.rs b/core/src/main.rs index 94b1ad8a..50416405 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -17,7 +17,9 @@ use crate::api::fs_api::read_dir; use crate::api::settings::{get_settings, update_settings}; // Import individual items from crate::api::utils -use crate::api::utils::{generate_qr_code, get_ip_address, get_system_information}; +use crate::api::utils::{ + generate_qr_code, get_ip_address, get_system_information, is_connected_to_wifi, +}; // Import individual items from crate::api::wifi use crate::api::wifi::{create_wifi_hotspot, kill_wifi_hotspot, scan_wifi}; @@ -97,6 +99,7 @@ fn main() -> Result<(), tauri::Error> { get_system_information, get_transfer_history, get_settings, + is_connected_to_wifi, update_settings, read_dir, scan_wifi // download_file, TODO: implement file transfering between peers diff --git a/src/components/MemoryInformation.tsx b/src/components/MemoryInformation.tsx index 5005182a..de77bf19 100644 --- a/src/components/MemoryInformation.tsx +++ b/src/components/MemoryInformation.tsx @@ -1,3 +1,6 @@ +import { WifiStatusContext } from "@/store/wifi-status"; +import { useContext } from "react"; + // use this to display the available memory export const MemoryInformation = ({ systemName, @@ -8,6 +11,8 @@ export const MemoryInformation = ({ usedMemory: string; totalMemory: string; }) => { + const { data: isConnectedToWifi } = useContext(WifiStatusContext); + const freeMemory = Number(totalMemory?.split(" ")[0]) - Number(usedMemory?.split(" ")[0]); const memBarWidth = "56%"; @@ -21,14 +26,17 @@ export const MemoryInformation = ({ }} >
- {usedMemory} of {totalMemory}
From 91d11f5dbb685b2a7762110eb369e0f9236d3768 Mon Sep 17 00:00:00 2001 From: Adeoye Adefemi Date: Thu, 2 May 2024 10:35:55 +0100 Subject: [PATCH 24/24] chore --- README.md | 2 +- src/components/nav/index.tsx | 2 +- src/pages/index.tsx | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ae28ec40..f7fd8477 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ _⚠️ the application is still a work in progress, hence, Some features are mi ## Description -FIleSync is an offline file-sharing application designed for Windows, Mac, and Linux operating systems. It allows users to transfer files seamlessly between PCs over WiFi without an internet connection. +FIleSync is an wifi file-sharing application designed for Windows, Mac, and Linux operating systems. It allows users to transfer files seamlessly between PCs over WiFi without an internet connection. ## Getting Started diff --git a/src/components/nav/index.tsx b/src/components/nav/index.tsx index 66f50c34..09cc79f1 100644 --- a/src/components/nav/index.tsx +++ b/src/components/nav/index.tsx @@ -87,7 +87,7 @@ export default function Navigation() { action={route.action} alternateIcon={route.alternateIcon} path={route.path} - disabled={Boolean(isConnectedToWifi)} + disabled={Boolean(isConnectedToWifi)=== false} /> ))}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx index bb59bdb3..3405f729 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -85,7 +85,7 @@ export default function Main() { await exit(1).then(()=>{ console.log("exited") }).catch(error => { - console.log("exited"); + console.log(error.message); }); } } @@ -95,7 +95,7 @@ export default function Main() { await relaunch().then(()=>{ console.log("refreshed") }).catch(error => { - console.log("refreshed"); + console.log(error.message); }); } @@ -125,7 +125,7 @@ export default function Main() { } // if done loading and not connected to wifi - if (!isLoading && isConnectedToWifi === true) { + if (!isLoading && !isConnectedToWifi) { return ( <>