mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-02 08:53:32 +00:00
init
This commit is contained in:
commit
dd5a38821d
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
node_modules
|
||||
src-tauri/target
|
||||
dist
|
||||
|
||||
.DS_Store
|
11
.prettierrc
Normal file
11
.prettierrc
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"useTabs": false,
|
||||
"printWidth": 100,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"jsxBracketSameLine": false,
|
||||
"semi": true,
|
||||
"quoteProps": "consistent"
|
||||
}
|
||||
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"nexusapp",
|
||||
"tailwindcss"
|
||||
]
|
||||
}
|
43
package.json
Normal file
43
package.json
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "nexus-client",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.0.0-beta.6",
|
||||
"@types/babel-core": "^6.25.7",
|
||||
"@types/react": "^17.0.18",
|
||||
"@types/react-dom": "^17.0.9",
|
||||
"concurrently": "^6.2.1",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"scripts": {
|
||||
"vite": "vite",
|
||||
"dev": "concurrently \"yarn tauri dev\" \"vite\"",
|
||||
"tauri": "tauri",
|
||||
"build": "vite build && tauri build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.4.7",
|
||||
"@headlessui/react": "^1.4.0",
|
||||
"@hookstate/core": "^3.0.8",
|
||||
"@hookstate/persistence": "^3.0.0",
|
||||
"@tailwindcss/forms": "^0.3.3",
|
||||
"@tauri-apps/api": "^1.0.0-beta.5",
|
||||
"@vechaiui/core": "^0.5.0",
|
||||
"@vechaiui/react": "^0.1.12",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.6",
|
||||
"autoprefixer": "^9",
|
||||
"phosphor-react": "^1.3.1",
|
||||
"postcss": "^7",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-dropzone": "^11.3.4",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
|
||||
"vite": "^2.4.4",
|
||||
"vite-tsconfig-paths": "^3.3.13"
|
||||
}
|
||||
}
|
6
postcss.config.js
Normal file
6
postcss.config.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {}
|
||||
}
|
||||
};
|
4
src-tauri/.gitignore
vendored
Normal file
4
src-tauri/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
3613
src-tauri/Cargo.lock
generated
Normal file
3613
src-tauri/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
25
src-tauri/Cargo.toml
Normal file
25
src-tauri/Cargo.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
[package]
|
||||
name = "spacedrop"
|
||||
version = "0.1.0"
|
||||
description = "Share files with a keybind"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
repository = ""
|
||||
default-run = "spacedrop"
|
||||
edition = "2018"
|
||||
build = "src/build.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.0.0-beta.3" }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
rebind = "0.2.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.0.0-beta.5", features = ["api-all", "menu"] }
|
||||
|
||||
[features]
|
||||
default = [ "custom-protocol" ]
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.icns
Normal file
Binary file not shown.
14
src-tauri/rustfmt.toml
Normal file
14
src-tauri/rustfmt.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2018"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
imports_granularity = "Crate"
|
3
src-tauri/src/build.rs
Normal file
3
src-tauri/src/build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
36
src-tauri/src/filestuff.rs
Normal file
36
src-tauri/src/filestuff.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
use std::fs::{self, DirEntry};
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
|
||||
struct User {
|
||||
username: String,
|
||||
email: String,
|
||||
sign_in_count: u64,
|
||||
active: bool,
|
||||
}
|
||||
|
||||
// one possible implementation of walking a directory only visiting files
|
||||
pub fn visit_dirs(dir: &Path, cb: &dyn Fn(&DirEntry)) -> io::Result<()> {
|
||||
if dir.is_dir() {
|
||||
for entry in fs::read_dir(dir)? {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
if path.is_dir() {
|
||||
visit_dirs(&path, cb)?;
|
||||
} else {
|
||||
cb(&entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn current_dir() -> io::Result<()> {
|
||||
let raw_entries = fs::read_dir(".")?
|
||||
.map(|res| res.map(|e| e.path()))
|
||||
.collect::<Result<Vec<_>, io::Error>>()?;
|
||||
|
||||
println!("Entries: {:?}", raw_entries);
|
||||
|
||||
Ok(())
|
||||
}
|
30
src-tauri/src/main.rs
Normal file
30
src-tauri/src/main.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
// mod filestuff;
|
||||
mod menu;
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct CustomResponse {
|
||||
message: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn message_from_rust(window: tauri::Window) -> Result<CustomResponse, String> {
|
||||
println!("Called from {}", window.label());
|
||||
Ok(CustomResponse {
|
||||
message: "Hello from rust!".to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// filestuff::current_dir();
|
||||
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![message_from_rust])
|
||||
.menu(menu::get_menu())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
13
src-tauri/src/menu.rs
Normal file
13
src-tauri/src/menu.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
use tauri::{CustomMenuItem, Menu, Submenu};
|
||||
|
||||
pub fn get_menu() -> Menu {
|
||||
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
|
||||
let close = CustomMenuItem::new("close".to_string(), "Close");
|
||||
let submenu = Submenu::new("File", Menu::new().add_item(quit).add_item(close));
|
||||
|
||||
let menu = Menu::new()
|
||||
// .add_native_item(MenuItem::Copy)
|
||||
// .add_item(CustomMenuItem::new("hide", "Hide"))
|
||||
.add_submenu(submenu);
|
||||
menu
|
||||
}
|
17
src-tauri/src/transfer.rs
Normal file
17
src-tauri/src/transfer.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
use std::fs;
|
||||
|
||||
struct Transfer {
|
||||
id: &str,
|
||||
};
|
||||
|
||||
struct File {
|
||||
id: &str
|
||||
};
|
||||
|
||||
pub fn run() {
|
||||
let path = "users/jamie";
|
||||
std::fs::read_dir(path: P) {
|
||||
|
||||
}
|
||||
};
|
67
src-tauri/tauri.conf.json
Normal file
67
src-tauri/tauri.conf.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"package": {
|
||||
"productName": "spacedrop",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"build": {
|
||||
"distDir": "../dist",
|
||||
"devPath": "http://localhost:8085",
|
||||
"beforeDevCommand": "",
|
||||
"beforeBuildCommand": ""
|
||||
},
|
||||
"tauri": {
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "org.nexusapp",
|
||||
"icon": ["icons/icon.icns"],
|
||||
"resources": [],
|
||||
"externalBin": [],
|
||||
"copyright": "",
|
||||
"category": "DeveloperTool",
|
||||
"shortDescription": "",
|
||||
"longDescription": "",
|
||||
"deb": {
|
||||
"depends": [],
|
||||
"useBootstrapper": false
|
||||
},
|
||||
"macOS": {
|
||||
"frameworks": [],
|
||||
"minimumSystemVersion": "",
|
||||
"useBootstrapper": false,
|
||||
"exceptionDomain": "",
|
||||
"signingIdentity": null,
|
||||
"entitlements": null
|
||||
},
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": ""
|
||||
}
|
||||
},
|
||||
"updater": {
|
||||
"active": false
|
||||
},
|
||||
"allowlist": {
|
||||
"all": true
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"title": "Nexus",
|
||||
"width": 800,
|
||||
"height": 500,
|
||||
"resizable": true,
|
||||
"fullscreen": false,
|
||||
"alwaysOnTop": false,
|
||||
"focus": true,
|
||||
"transparent": true,
|
||||
"fileDropEnabled": false,
|
||||
"decorations": false,
|
||||
"center": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
|
||||
}
|
||||
}
|
||||
}
|
44
src/App.tsx
Normal file
44
src/App.tsx
Normal file
|
@ -0,0 +1,44 @@
|
|||
import React from 'react';
|
||||
import { Button, colors, ColorScheme, extendTheme, Input } from '@vechaiui/react';
|
||||
import { VechaiProvider } from '@vechaiui/react';
|
||||
|
||||
export const pale: ColorScheme = {
|
||||
id: 'pale',
|
||||
type: 'dark',
|
||||
colors: {
|
||||
bg: {
|
||||
base: colors.blueGray['800'],
|
||||
fill: colors.blueGray['900']
|
||||
},
|
||||
text: {
|
||||
foreground: colors.blueGray['100'],
|
||||
muted: colors.blueGray['300']
|
||||
},
|
||||
primary: colors.violet,
|
||||
neutral: colors.blueGray
|
||||
}
|
||||
};
|
||||
|
||||
const theme = extendTheme({
|
||||
cursor: 'pointer',
|
||||
colorSchemes: {
|
||||
pale
|
||||
}
|
||||
});
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<VechaiProvider theme={theme} colorScheme="pale">
|
||||
<div className="p-8">
|
||||
<div className="flex flex-wrap w-full p-8 space-x-2">
|
||||
<Button>Button</Button>
|
||||
<Button variant="solid">Button</Button>
|
||||
<Button variant="light">Button</Button>
|
||||
<Button variant="ghost">Button</Button>
|
||||
<Button variant="link">Button</Button>
|
||||
</div>
|
||||
<Input />
|
||||
</div>
|
||||
</VechaiProvider>
|
||||
);
|
||||
}
|
17
src/hooks/useFocusState.tsx
Normal file
17
src/hooks/useFocusState.tsx
Normal file
|
@ -0,0 +1,17 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
|
||||
export function useFocusState() {
|
||||
const [focused, setFocused] = useState(true);
|
||||
const focus = () => setFocused(true);
|
||||
const blur = () => setFocused(false);
|
||||
useEffect(() => {
|
||||
window.addEventListener('focus', focus);
|
||||
window.addEventListener('blur', blur);
|
||||
return () => {
|
||||
window.removeEventListener('focus', focus);
|
||||
window.removeEventListener('blur', blur);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return [focused];
|
||||
}
|
13
src/index.html
Normal file
13
src/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Nexus</title>
|
||||
</head>
|
||||
<body style="overflow: hidden">
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
11
src/index.tsx
Normal file
11
src/index.tsx
Normal file
|
@ -0,0 +1,11 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
import './style.css';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
19
src/style.css
Normal file
19
src/style.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
.bg-transparent {
|
||||
@apply bg-[#00000000];
|
||||
}
|
||||
.border-transparent {
|
||||
@apply border-[#00000000];
|
||||
}
|
||||
.border-current {
|
||||
@apply border-[#00000000];
|
||||
}
|
||||
}
|
7
src/vite-env.d.ts
vendored
Normal file
7
src/vite-env.d.ts
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/// <reference types="vite/client" />
|
||||
|
||||
declare interface ImportMetaEnv {
|
||||
VITE_OS: string;
|
||||
}
|
||||
|
||||
declare module '@babel/core' {}
|
28
tailwind.config.js
Normal file
28
tailwind.config.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const colors = require('tailwindcss/colors');
|
||||
|
||||
module.exports = {
|
||||
purge: [
|
||||
'./src/index.html',
|
||||
'./src/**/*.{vue,js,ts,jsx,tsx}',
|
||||
'./node_modules/@vechaiui/**/*.{js,ts,jsx,tsx}'
|
||||
],
|
||||
darkMode: 'media',
|
||||
mode: 'jit',
|
||||
theme: {
|
||||
colors: {
|
||||
...colors,
|
||||
gray: {
|
||||
...colors.gray,
|
||||
800: '#2A2A37',
|
||||
900: '#24242F'
|
||||
// 100: '#F1EBEB'
|
||||
}
|
||||
}
|
||||
},
|
||||
variants: {
|
||||
extend: {
|
||||
// bg: { transparent: 'transparent' }
|
||||
}
|
||||
},
|
||||
plugins: [require('@tailwindcss/forms'), require('@vechaiui/core')]
|
||||
};
|
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": false,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
22
vite.config.ts
Normal file
22
vite.config.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import reactRefresh from '@vitejs/plugin-react-refresh';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 8085
|
||||
},
|
||||
plugins: [reactRefresh(), tsconfigPaths()],
|
||||
esbuild: {
|
||||
jsxInject: 'import {jsx as _jsx} from "react/jsx-runtime"'
|
||||
},
|
||||
root: 'src',
|
||||
publicDir: 'assets',
|
||||
build: {
|
||||
outDir: '../dist',
|
||||
emptyOutDir: false,
|
||||
assetsDir: '.'
|
||||
},
|
||||
base: ''
|
||||
});
|
Loading…
Reference in a new issue