mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
remove unneeded wrapper components
This commit is contained in:
parent
0a4b1f79de
commit
b01267de17
4 changed files with 14 additions and 80 deletions
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
GoToSocial
|
|
||||||
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const Promise = require("bluebird");
|
|
||||||
const React = require("react");
|
|
||||||
const { Route, Switch } = require("wouter");
|
|
||||||
|
|
||||||
module.exports = function AdminPanel({oauth, routes}) {
|
|
||||||
return (
|
|
||||||
<Switch>
|
|
||||||
{routes}
|
|
||||||
</Switch>
|
|
||||||
);
|
|
||||||
};
|
|
|
@ -36,19 +36,13 @@ require("./style.css");
|
||||||
// TODO: nested categories?
|
// TODO: nested categories?
|
||||||
const nav = {
|
const nav = {
|
||||||
"User": {
|
"User": {
|
||||||
Component: require("./user"),
|
"Profile": require("./user/profile.js"),
|
||||||
entries: {
|
"Settings": require("./user/settings.js"),
|
||||||
"Profile": require("./user/profile.js"),
|
|
||||||
"Settings": require("./user/settings.js"),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Admin": {
|
"Admin": {
|
||||||
Component: require("./admin"),
|
"Instance Settings": require("./admin/settings.js"),
|
||||||
entries: {
|
"Federation": require("./admin/federation.js"),
|
||||||
"Instance Settings": require("./admin/settings.js"),
|
"Customization": require("./admin/customization.js")
|
||||||
"Federation": require("./admin/federation.js"),
|
|
||||||
"Customization": require("./admin/customization.js")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const React = require("react");
|
const React = require("react");
|
||||||
const { Link, Route, Redirect } = require("wouter");
|
const { Link, Route, Switch, Redirect } = require("wouter");
|
||||||
const { ErrorBoundary } = require("react-error-boundary");
|
const { ErrorBoundary } = require("react-error-boundary");
|
||||||
|
|
||||||
const ErrorFallback = require("../components/error");
|
const ErrorFallback = require("../components/error");
|
||||||
|
@ -33,7 +33,7 @@ module.exports = function generateViews(struct) {
|
||||||
const sidebar = [];
|
const sidebar = [];
|
||||||
const panelRouter = [];
|
const panelRouter = [];
|
||||||
|
|
||||||
Object.entries(struct).forEach(([name, {Component, entries}]) => {
|
Object.entries(struct).forEach(([name, entries]) => {
|
||||||
let base = `/settings/${urlSafe(name)}`;
|
let base = `/settings/${urlSafe(name)}`;
|
||||||
|
|
||||||
let links = [];
|
let links = [];
|
||||||
|
@ -50,9 +50,9 @@ module.exports = function generateViews(struct) {
|
||||||
|
|
||||||
routes.push((
|
routes.push((
|
||||||
<Route path={url} key={url}>
|
<Route path={url} key={url}>
|
||||||
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={() => {}}>
|
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={() => { }}>
|
||||||
{/* FIXME: implement onReset */}
|
{/* FIXME: implement onReset */}
|
||||||
<ViewComponent/>
|
<ViewComponent />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Route>
|
</Route>
|
||||||
));
|
));
|
||||||
|
@ -64,14 +64,16 @@ module.exports = function generateViews(struct) {
|
||||||
|
|
||||||
panelRouter.push(
|
panelRouter.push(
|
||||||
<Route key={base} path={base}>
|
<Route key={base} path={base}>
|
||||||
<Redirect to={firstRoute}/>
|
<Redirect to={firstRoute} />
|
||||||
</Route>
|
</Route>
|
||||||
);
|
);
|
||||||
|
|
||||||
let childrenPath = `${base}/:section`;
|
let childrenPath = `${base}/:section`;
|
||||||
panelRouter.push(
|
panelRouter.push(
|
||||||
<Route key={childrenPath} path={childrenPath}>
|
<Route key={childrenPath} path={childrenPath}>
|
||||||
<Component routes={routes}/>
|
<Switch>
|
||||||
|
{routes}
|
||||||
|
</Switch>
|
||||||
</Route>
|
</Route>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -89,5 +91,5 @@ module.exports = function generateViews(struct) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {sidebar, panelRouter};
|
return { sidebar, panelRouter };
|
||||||
};
|
};
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
GoToSocial
|
|
||||||
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const Promise = require("bluebird");
|
|
||||||
const React = require("react");
|
|
||||||
const { Switch } = require("wouter");
|
|
||||||
|
|
||||||
module.exports = function UserPanel({routes}) {
|
|
||||||
return (
|
|
||||||
<Switch>
|
|
||||||
{routes}
|
|
||||||
</Switch>
|
|
||||||
);
|
|
||||||
};
|
|
Loading…
Reference in a new issue