diff --git a/internal/routes/mod.go b/internal/routes/mod.go
index 8ad5d77..2cf1f99 100644
--- a/internal/routes/mod.go
+++ b/internal/routes/mod.go
@@ -17,7 +17,7 @@ func New(app *gin.Engine) {
app.Use(static.Serve("/assets", static.LocalFile("./assets", false)))
app.NoRoute(func(ctx *gin.Context) {
- ctx.HTML(200, "index.html", nil)
+ ctx.File("./public/index.html")
})
app.GET("favicon.ico", func(ctx *gin.Context) {
@@ -52,8 +52,10 @@ func New(app *gin.Engine) {
entries := make([]service.DirEntry, 0)
for _, fd := range entry {
+ var info, _ = fd.Info()
entries = append(entries, service.DirEntry{
- Name: fd.Name(),
+ Name: fd.Name(),
+ FileSize: uint64(info.Size()),
})
}
diff --git a/internal/service/worker.go b/internal/service/worker.go
index 3e10908..a78dd09 100644
--- a/internal/service/worker.go
+++ b/internal/service/worker.go
@@ -10,7 +10,8 @@ import (
type WorkerService struct{}
type DirEntry struct {
- Name string `json:"name"`
+ Name string `json:"name"`
+ FileSize uint64 `json:"file_size"`
}
func NewWorkerService() *WorkerService {
diff --git a/src/components/dashboard/index.tsx b/src/components/dashboard/index.tsx
index 5058e63..2ae7cdc 100644
--- a/src/components/dashboard/index.tsx
+++ b/src/components/dashboard/index.tsx
@@ -1,7 +1,28 @@
+import { useEffect, useState } from "react";
import Directory from "../directory";
+import { usePath } from "../../store/path";
+import { useLocation } from "react-router";
+
import "./dashboard.scss";
function Dashboard() {
+ const path = usePath();
+ const location = useLocation();
+ const [load, setLoad] = useState(false);
+
+ useEffect(() => {
+ if (!load) {
+ path.update(location.pathname.substring(1, location.pathname.length));
+ setLoad(true);
+ }
+
+ const id = setInterval(() => {
+ path.update(location.pathname.substring(1, location.pathname.length));
+ }, 5000);
+
+ return () => clearInterval(id);
+ }, [load, path, location]);
+
return (