Skip to content

Commit

Permalink
[#62] Refactor ScriptsPage
Browse files Browse the repository at this point in the history
Refactor Scripts class component to functional ScriptsPage component.
Move to folder pages
  • Loading branch information
palagdan committed Nov 1, 2024
1 parent 1291b82 commit 17f0b9f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/Router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { Routes, BrowserRouter, Route } from "react-router-dom";
import HomePage from "./pages/Home/HomePage.jsx";
import Executions from "./components/Executions.jsx";
import Scripts from "./components/Scripts.jsx";
import ScriptsPage from "./pages/Script/ScriptsPage.jsx";
import Dagre from "./components/dagre/Dagre.jsx";
import NoMatch from "./components/NoMatch.jsx";
import Layout from "./layouts/Layout.jsx";
Expand All @@ -13,7 +13,7 @@ const Router = () => {
<Routes>
<Route element={<Layout />}>
<Route path="/" element={<HomePage />} />
<Route path="scripts" element={<Scripts />} />
<Route path="scripts" element={<ScriptsPage />} />
<Route path="executions" element={<Executions />} />
<Route path="script" element={<Dagre />} />
<Route path="*" element={<NoMatch />} />
Expand Down
19 changes: 0 additions & 19 deletions src/components/Scripts.jsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/treebeard/ScriptsTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ class ScriptsTree extends React.Component {
} else {
return (
<Fragment>
<h3>Scripts</h3>
<p>Right click on directory/file to add/remove file</p>
<div style={styles.component}>
<Treebeard
data={this.state.data}
Expand Down
22 changes: 22 additions & 0 deletions src/pages/Script/ScriptsPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import Grid from "@mui/material/Grid2";
import ScriptsTree from "../../components/treebeard/ScriptsTree.jsx";
import { Typography } from "@mui/material";

const ScriptsPage = () => {
return (
<Grid container spacing={2}>
<Grid item xs={12} sm={6}>
<Typography variant="h4" component="h3" gutterBottom>
Scripts
</Typography>
<Typography variant="body1" component="p" gutterBottom>
Right-click on directory/file to add/remove file
</Typography>
<ScriptsTree />
</Grid>
</Grid>
);
};

export default ScriptsPage;

0 comments on commit 17f0b9f

Please sign in to comment.