diff --git a/.vscode/settings.json b/.vscode/settings.json index 838c51cb2..f42f50772 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,12 +2,14 @@ "cSpell.words": [ "bpfrpt", "creationdate", + "honkhonk", "ipfs", "Keepsafe", "pathctx", "proptype", "quicktime", "repr", + "svgr", "tailwindcss" ], "rust-analyzer.procMacro.enable": true, diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index d28b31fc1..b7e7a7596 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -5,7 +5,7 @@ }, "build": { "distDir": "../dist", - "devPath": "http://localhost:8085", + "devPath": "http://localhost:8001", "beforeDevCommand": "", "beforeBuildCommand": "" }, diff --git a/apps/desktop/src/index.tsx b/apps/desktop/src/index.tsx index bcb8d29de..f2eb22db7 100644 --- a/apps/desktop/src/index.tsx +++ b/apps/desktop/src/index.tsx @@ -1,14 +1,14 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { createRoot } from 'react-dom/client'; // import Spacedrive interface -import SpacedriveInterface from '@sd/interface'; +import SpacedriveInterface, { Platform } from '@sd/interface'; import '@sd/interface/dist/style.css'; // import types from Spacedrive core (TODO: re-export from client would be cleaner) import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core'; // import Spacedrive JS client -import { BaseTransport, setTransport } from '@sd/client'; +import { BaseTransport } from '@sd/client'; // import tauri apis import { invoke, os } from '@tauri-apps/api'; @@ -21,18 +21,34 @@ class Transport extends BaseTransport { return await invoke('client_command_transport', { data: query }); } } -setTransport(new Transport()); -const root = createRoot(document.getElementById('root')!); +function App() { + function getPlatform(platform: string): Platform { + switch (platform) { + case 'darwin': + return 'macOS'; + case 'win32': + return 'windows'; + case 'linux': + return 'linux'; + default: + return 'browser'; + } + } -root.render( - + const [platform, setPlatform] = useState('macOS'); + + useEffect(() => { + os.platform().then((platform) => setPlatform(getPlatform(platform))); + }, []); + + return ( + ); +} + +const root = createRoot(document.getElementById('root')!); + +root.render( + + ); diff --git a/apps/desktop/vite.config.ts b/apps/desktop/vite.config.ts index 3270f519e..6b2fb9fd9 100644 --- a/apps/desktop/vite.config.ts +++ b/apps/desktop/vite.config.ts @@ -5,23 +5,17 @@ import react from '@vitejs/plugin-react'; // https://vitejs.dev/config/ export default defineConfig({ server: { - port: 8085 + port: 8001 }, plugins: [ react({ jsxRuntime: 'classic' }) ], - esbuild: { - jsxInject: 'import {jsx as _jsx} from "react/jsx-runtime"' - }, - root: 'src', - publicDir: '@sd/interface/src/assets', + publicDir: '../../packages/interface/src/assets', build: { outDir: '../dist', - emptyOutDir: false, assetsDir: '.' - }, - base: '' + } }); diff --git a/apps/web/components/Layout.tsx b/apps/web/components/Layout.tsx index 546511c06..cb35cf876 100644 --- a/apps/web/components/Layout.tsx +++ b/apps/web/components/Layout.tsx @@ -15,26 +15,16 @@ const Layout = ({ children, title = 'This is the default title' }: Props) => (
- */}
- {children} -
-
- I'm here to stay (Footer) -
+
{children as any}
+ {/*
+ Version 0.1.0 +
*/} ); diff --git a/apps/web/components/global.scss b/apps/web/components/global.scss new file mode 100644 index 000000000..deb636ec1 --- /dev/null +++ b/apps/web/components/global.scss @@ -0,0 +1,8 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + + +html { + // background-color: black; +} \ No newline at end of file diff --git a/apps/web/interfaces/index.ts b/apps/web/interfaces/index.ts deleted file mode 100644 index 68528c551..000000000 --- a/apps/web/interfaces/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -// You can include shared interfaces/types in a separate file -// and then use them in any component by importing them. For -// example, to import the interface below do: -// -// import { User } from 'path/to/interfaces'; - -export type User = { - id: number - name: string -} diff --git a/apps/web/package.json b/apps/web/package.json index 6e4fbc63c..153b76e08 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -8,9 +8,14 @@ "type-check": "tsc" }, "dependencies": { + "@sd/interface": "*", + "autoprefixer": "^10.4.4", "next": "latest", + "postcss": "^8.4.12", "react": "^17.0.2", - "react-dom": "^17.0.2" + "react-dom": "^17.0.2", + "sass": "^1.50.0", + "tailwindcss": "^3.0.23" }, "devDependencies": { "@types/node": "^12.12.21", diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx new file mode 100644 index 000000000..fa9af6e2a --- /dev/null +++ b/apps/web/pages/_app.tsx @@ -0,0 +1,7 @@ +import '../components/global.scss'; + +function MyApp({ Component, pageProps }) { + return ; +} + +export default MyApp; diff --git a/apps/web/pages/index.tsx b/apps/web/pages/index.tsx index 0e53394ab..cc241ad49 100644 --- a/apps/web/pages/index.tsx +++ b/apps/web/pages/index.tsx @@ -1,14 +1,17 @@ import Link from 'next/link'; import Layout from '../components/Layout'; +// import Spacedrive interface + const IndexPage = () => ( -

A file explorer from the future

-

- - About - -

+

A file explorer from the future

+