This commit is contained in:
Jamie Pine
2022-04-10 23:52:53 -07:00
15 changed files with 111 additions and 76 deletions

BIN
Cargo.lock generated
View File

Binary file not shown.

View File

@@ -5,18 +5,18 @@
"license": "MIT",
"private": true,
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.6",
"@tauri-apps/cli": "^1.0.0-rc.8",
"@types/babel-core": "^6.25.7",
"@types/byte-size": "^8.1.0",
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"@types/react-router-dom": "^5.3.1",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-router-dom": "^5.3.3",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/tailwindcss": "^2.2.1",
"concurrently": "^6.2.1",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
"@types/tailwindcss": "^3.0.10",
"concurrently": "^7.1.0",
"prettier": "^2.6.2",
"typescript": "^4.6.3"
},
"scripts": {
"vite": "vite",
@@ -28,46 +28,46 @@
"react-virtualized": "patch:react-virtualized@9.22.3#./path/to/react-virtualized-9.22.3.patch"
},
"dependencies": {
"@apollo/client": "^3.4.7",
"@headlessui/react": "^1.4.0",
"@heroicons/react": "^1.0.4",
"@radix-ui/react-dialog": "^0.1.5",
"@apollo/client": "^3.5.10",
"@headlessui/react": "^1.5.0",
"@heroicons/react": "^1.0.6",
"@radix-ui/react-dialog": "^0.1.7",
"@radix-ui/react-slider": "^0.1.4",
"@sd/core": "*",
"@sd/client": "*",
"@sd/ui": "*",
"@tauri-apps/api": "^1.0.0-beta.5",
"@sd/client": "workspace:*",
"@sd/core": "workspace:*",
"@sd/ui": "workspace:*",
"@tauri-apps/api": "^1.0.0-rc.3",
"@types/pretty-bytes": "^5.2.0",
"@types/react-table": "^7.7.6",
"@types/react-virtualized": "^9.21.14",
"@types/react-table": "^7.7.10",
"@types/react-virtualized": "^9.21.21",
"@vitejs/plugin-react-refresh": "^1.3.6",
"autoprefixer": "^9",
"autoprefixer": "^10.4.4",
"byte-size": "^8.1.0",
"clsx": "^1.1.1",
"immer": "^9.0.12",
"jotai": "^1.6.0",
"moment": "^2.29.1",
"phosphor-react": "^1.3.1",
"pretty-bytes": "^5.6.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-error-boundary": "^3.1.3",
"jotai": "^1.6.2",
"moment": "^2.29.2",
"phosphor-react": "^1.4.1",
"pretty-bytes": "^6.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-dropzone": "^12.0.4",
"react-error-boundary": "^3.1.4",
"react-hotkeys-hook": "^3.4.4",
"react-json-view": "^1.21.3",
"react-portal": "^4.2.1",
"react-query": "^3.34.16",
"react-router": "6.2.1",
"react-router-dom": "6.2.1",
"react-portal": "^4.2.2",
"react-query": "^3.34.19",
"react-router": "6.3.0",
"react-router-dom": "6.3.0",
"react-spline": "^1.2.1",
"react-transition-group": "^4.4.2",
"react-virtuoso": "^2.2.6",
"rooks": "^5.7.1",
"tailwindcss": "^3.0.7",
"vite": "^2.4.4",
"react-virtuoso": "^2.9.0",
"rooks": "^5.11.0",
"tailwindcss": "^3.0.23",
"vite": "^2.9.1",
"vite-plugin-filter-replace": "^0.1.9",
"vite-plugin-react-svg": "^0.2.0",
"vite-tsconfig-paths": "^3.3.13",
"zustand": "^3.7.1"
"vite-tsconfig-paths": "^3.4.1",
"zustand": "^3.7.2"
}
}

View File

@@ -5,8 +5,6 @@ use tauri::api::path;
use tauri::Manager;
mod menu;
use window_shadows::set_shadow;
#[tauri::command(async)]
async fn client_query_transport(
core: tauri::State<'_, CoreController>,
@@ -55,11 +53,14 @@ async fn main() {
.setup(|app| {
let app = app.handle();
app.windows().iter().for_each(|(_, window)| {
set_shadow(&window, true).unwrap_or(());
#[cfg(not(target_os = "linux"))]
{
app.windows().iter().for_each(|(_, window)| {
window_shadows::set_shadow(&window, true).unwrap_or(());
window.start_dragging().unwrap_or(());
});
window.start_dragging().unwrap_or(());
});
}
// core event transport
tokio::spawn(async move {

View File

@@ -24,6 +24,7 @@ import LocationSettings from './screens/settings/LocationSettings';
import { RedirectPage } from './screens/Redirect';
import { QueryClient, QueryClientProvider } from 'react-query';
import { platform } from '@tauri-apps/api/os';
import { ClientProvider } from '@sd/client';
const queryClient = new QueryClient();
@@ -83,6 +84,10 @@ function Router() {
let location = useLocation();
let state = location.state as { backgroundLocation?: Location };
useEffect(() => {
console.log({ url: location.pathname });
}, [state]);
return (
<>
<Routes location={state?.backgroundLocation || location}>
@@ -91,7 +96,7 @@ function Router() {
<Route path="overview" element={<OverviewScreen />} />
<Route path="spaces" element={<SpacesScreen />} />
<Route path="settings/*" element={<SettingsRoutes />} />
<Route path="explorer" element={<ExplorerScreen />} />
<Route path="explorer/*" element={<ExplorerScreen />} />
<Route path="*" element={<NotFound />} />
</Route>
</Routes>
@@ -124,7 +129,6 @@ function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
function NotFound() {
const navigate = useNavigate();
return (
<div
data-tauri-drag-region
@@ -142,6 +146,10 @@ function NotFound() {
);
}
// useHotkeys('command+q', () => {
// process.exit();
// });
function AppContainer() {
useCoreEvents();
return (
@@ -152,10 +160,18 @@ function AppContainer() {
}
export default function App() {
// @ts-ignore: TODO: This is a hack and a better solution should probably be found. This exists so that the queryClient can be accessed within the subpackage '@sd/client'. Refer to <ClientProvider /> for where this is used.
if (window.ReactQueryClient === undefined) {
// @ts-ignore
window.ReactQueryClient = queryClient;
}
return (
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={() => {}}>
<QueryClientProvider client={queryClient}>
<AppContainer />
<QueryClientProvider client={queryClient} contextSharing={false}>
<ClientProvider>
<AppContainer />
</ClientProvider>
</QueryClientProvider>
</ErrorBoundary>
);

View File

@@ -86,14 +86,14 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
justifyLeft?: boolean;
}
export const Button: React.FC<ButtonProps> = ({ loading, ...props }) => {
export const Button: React.FC<ButtonProps> = ({ loading, justifyLeft, ...props }) => {
return (
<button
{...props}
className={clsx(
'border rounded-md items-center transition-colors duration-100 cursor-default',
{ 'opacity-5': loading, '!p-1': props.noPadding },
{ 'justify-center': !props.justifyLeft },
{ 'justify-center': !justifyLeft },
sizes[props.size || 'default'],
variants[props.variant || 'default'],
{ 'active:translate-y-[1px]': props.pressEffect },

View File

@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import App from './App';
import './style.css';
@@ -18,9 +18,9 @@ class Transport extends BaseTransport {
}
setTransport(new Transport());
ReactDOM.render(
const root = createRoot(document.getElementById('root')!);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);

View File

@@ -28,6 +28,7 @@ pub mod util;
// pub mod native;
// a wrapper around external input with a returning sender channel for core to respond
#[derive(Debug)]
pub struct ReturnableMessage<D, R = Result<CoreResponse, CoreError>> {
data: D,
return_sender: oneshot::Sender<R>,

View File

@@ -21,8 +21,8 @@
"server": "pnpm --filter @sd/server -- "
},
"devDependencies": {
"prettier": "^2.5.1",
"turbo": "latest"
"prettier": "^2.6.2",
"turbo": "^1.2.1"
},
"turbo": {
"pipeline": {

View File

@@ -0,0 +1,11 @@
import React from 'react';
import { QueryClientProvider } from 'react-query';
// The ClientProvider injects the React-query context into the "context store" of the current package. This is needed due to the fact the repository is a monorepo.
// This is a pretty hacky solution and a better solution should probably be found to replace it.
export function ClientProvider({ children }: any) {
return (
// @ts-ignore: This exists to add the QueryClientProvider to the current subpackage '@sd/client'. The ReactQueryClient is fetched from the window object (which is set in the parent application).
<QueryClientProvider client={window.ReactQueryClient}>{children}</QueryClientProvider>
);
}

View File

@@ -1,2 +1,3 @@
export * from './bridge';
export * from './files';
export * from './ClientProvider';

View File

@@ -18,18 +18,22 @@
"devDependencies": {
"scripts": "*",
"tsconfig": "*",
"typescript": "^4.5.3"
"typescript": "^4.6.3",
"react": "^18.0.0",
"react-query": "^3.34.19"
},
"jest": {
"preset": "scripts/jest/node"
},
"dependencies": {
"@sd/config": "*",
"@sd/core": "*",
"@sd/config": "workspace:*",
"@sd/core": "workspace:*",
"eventemitter3": "^4.0.7",
"immer": "^9.0.12",
"react": "^17.0.2",
"react-query": "^3.34.16",
"zustand": "^3.7.1"
"zustand": "^3.7.2"
},
"peerDependencies": {
"react": "^18.0.0",
"react-query": "^3.34.19"
}
}

View File

@@ -1,11 +1,12 @@
{
"compilerOptions": {
"lib": ["esnext"],
"module": "esnext",
"outDir": "./dist",
"rootDir": "./lib"
"lib": ["esnext"],
"module": "esnext",
"outDir": "./dist",
"rootDir": "./lib",
"jsx": "react"
},
"extends": "../config/tsconfig/base.json",
"include": ["**/*.ts"],
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist"]
}
}

View File

@@ -7,10 +7,10 @@
"eslint-preset.js"
],
"devDependencies": {
"typescript": "^4.5.3"
"typescript": "^4.6.3"
},
"dependencies": {
"eslint-config-next": "^12.0.3",
"eslint-config-prettier": "^8.3.0"
"eslint-config-next": "^12.1.4",
"eslint-config-prettier": "^8.5.0"
}
}

View File

@@ -8,14 +8,14 @@
"build": "tsc"
},
"dependencies": {
"@headlessui/react": "^1.4.0",
"@headlessui/react": "^1.5.0",
"clsx": "^1.1.1",
"react": "^17.0.2"
"react": "^18.0.0"
},
"devDependencies": {
"@sd/config": "*",
"typescript": "^4.5.3",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11"
"@sd/config": "workspace:*",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.6.3"
}
}

BIN
pnpm-lock.yaml generated
View File

Binary file not shown.