t
This commit is contained in:
parent
e668c16901
commit
3e6a69ccbf
2056
package-lock.json
generated
2056
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
|||||||
"next-build": "next build src-next"
|
"next-build": "next build src-next"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.2.0",
|
"@tauri-apps/api": "^1.6.0",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "^2.2.1",
|
"@tauri-apps/plugin-clipboard-manager": "^2.2.1",
|
||||||
"@tauri-apps/plugin-dialog": "^2.2.0",
|
"@tauri-apps/plugin-dialog": "^2.2.0",
|
||||||
"@tauri-apps/plugin-fs": "^2.2.0",
|
"@tauri-apps/plugin-fs": "^2.2.0",
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Tree from 'components/Tree';
|
import Tree from 'components/Tree';
|
||||||
import rawData from '../data.json';
|
import rawData from '../data.json';
|
||||||
|
|
||||||
interface TreeNodeData {
|
interface TreeNodeData {
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
@ -25,6 +24,7 @@ const addFilesToData = (data: any): TreeNodeData[] => {
|
|||||||
|
|
||||||
const data = addFilesToData(rawData);
|
const data = addFilesToData(rawData);
|
||||||
|
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '100vw', height: '100vh', backgroundColor: "#222" }}>
|
<div style={{ width: '100vw', height: '100vh', backgroundColor: "#222" }}>
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import React from 'react';
|
"use client";
|
||||||
|
|
||||||
|
import React, {useEffect} from 'react';
|
||||||
import TreeNode from '../TreeNode';
|
import TreeNode from '../TreeNode';
|
||||||
|
import { invoke } from '@tauri-apps/api/tauri'
|
||||||
|
|
||||||
interface TreeNodeData {
|
interface TreeNodeData {
|
||||||
name: string;
|
name: string;
|
||||||
@ -18,6 +21,13 @@ interface TreeProps {
|
|||||||
const Tree: React.FC<TreeProps> = ({ data }) => {
|
const Tree: React.FC<TreeProps> = ({ data }) => {
|
||||||
const rootSize = data[0].size;
|
const rootSize = data[0].size;
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
invoke('load_folders')
|
||||||
|
.then(() => console.log("Folders loaded"))
|
||||||
|
.catch(console.error)
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tree">
|
<div className="tree">
|
||||||
{data.map((node) => (
|
{data.map((node) => (
|
||||||
|
@ -3,7 +3,7 @@ use std::path::PathBuf;
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize, Debug)]
|
#[derive(Serialize, Debug)]
|
||||||
struct FolderData {
|
pub struct FolderData {
|
||||||
name: String,
|
name: String,
|
||||||
path: String,
|
path: String,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -7,6 +7,7 @@ mod folder_crawler;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.invoke_handler(tauri::generate_handler![load_folders])
|
||||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||||
.plugin(tauri_plugin_http::init())
|
.plugin(tauri_plugin_http::init())
|
||||||
.plugin(tauri_plugin_os::init())
|
.plugin(tauri_plugin_os::init())
|
||||||
@ -22,6 +23,8 @@ fn main() {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn load_folders(){
|
fn load_folders(){
|
||||||
|
println!("TEST");
|
||||||
|
|
||||||
let root = PathBuf::from("C:/Users/Damie/Desktop");
|
let root = PathBuf::from("C:/Users/Damie/Desktop");
|
||||||
let crawler = folder_crawler::FolderCrawler::new(root);
|
let crawler = folder_crawler::FolderCrawler::new(root);
|
||||||
for folder_data in crawler {
|
for folder_data in crawler {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user