From df0e6d93eb92e277f3cb6048672472ee50406fcd Mon Sep 17 00:00:00 2001
From: viown <48097677+viown@users.noreply.github.com>
Date: Sat, 7 Jun 2025 10:23:28 +0300
Subject: [PATCH] Create separate widget component
---
.../components/widgets/ServerPathWidget.tsx | 30 +++++-----------
.../dashboard/components/widgets/Widget.tsx | 36 +++++++++++++++++++
2 files changed, 44 insertions(+), 22 deletions(-)
create mode 100644 src/apps/dashboard/components/widgets/Widget.tsx
diff --git a/src/apps/dashboard/components/widgets/ServerPathWidget.tsx b/src/apps/dashboard/components/widgets/ServerPathWidget.tsx
index 98fe4be57..b7c960e48 100644
--- a/src/apps/dashboard/components/widgets/ServerPathWidget.tsx
+++ b/src/apps/dashboard/components/widgets/ServerPathWidget.tsx
@@ -1,35 +1,21 @@
-import ChevronRight from '@mui/icons-material/ChevronRight';
-import Button from '@mui/material/Button';
import List from '@mui/material/List';
-import Typography from '@mui/material/Typography';
import React from 'react';
import { useSystemStorage } from 'apps/dashboard/features/storage/api/useSystemStorage';
import StorageListItem from 'apps/dashboard/features/storage/components/StorageListItem';
import globalize from 'lib/globalize';
+import Widget from './Widget';
const ServerPathWidget = () => {
const { data: systemStorage } = useSystemStorage();
return (
- <>
- }
- sx={{
- marginTop: 1,
- marginBottom: 1
- }}
- // NOTE: We should use a react-router Link component, but components rendered in legacy views lack the
- // routing context
- href='#/dashboard/settings'
- >
-
- {globalize.translate('HeaderPaths')}
-
-
-
+
{
folder={systemStorage?.WebFolder}
/>
- >
+
);
};
diff --git a/src/apps/dashboard/components/widgets/Widget.tsx b/src/apps/dashboard/components/widgets/Widget.tsx
new file mode 100644
index 000000000..a2a4bc8b1
--- /dev/null
+++ b/src/apps/dashboard/components/widgets/Widget.tsx
@@ -0,0 +1,36 @@
+import Box from '@mui/material/Box';
+import Button from '@mui/material/Button';
+import Typography from '@mui/material/Typography';
+import ChevronRight from '@mui/icons-material/ChevronRight';
+import React from 'react';
+
+type IProps = {
+ title: string;
+ href?: string;
+ children: React.ReactNode;
+};
+
+const Widget = ({ title, href, children }: IProps) => {
+ return (
+
+ }
+ sx={{
+ marginTop: 1,
+ marginBottom: 1
+ }}
+ href={href}
+ >
+
+ {title}
+
+
+
+ {children}
+
+ );
+};
+
+export default Widget;