Skip to content

Commit

Permalink
change: if statements to switch statements in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
harshsinghatz committed Oct 13, 2022
1 parent 53c1a1f commit 907d572
Showing 1 changed file with 41 additions and 45 deletions.
86 changes: 41 additions & 45 deletions components/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,21 +428,20 @@ function App() {
<Route
exact
path={projectsPathMainWithParams}
render={(props) => {
const { resourceOrPrebuild } = props.match.params;
if (resourceOrPrebuild === "events") {
return <Events />;
}
if (resourceOrPrebuild === "prebuilds") {
return <Prebuilds />;
}
if (resourceOrPrebuild === "settings") {
return <ProjectSettings />;
}
if (resourceOrPrebuild === "variables") {
return <ProjectVariables />;
render={({ match }) => {
const { resourceOrPrebuild } = match.params;
switch (resourceOrPrebuild) {
case "events":
return <Events />;
case "prebuilds":
return <Prebuilds />;
case "settings":
return <ProjectSettings />;
case "variables":
return <ProjectVariables />;
default:
return resourceOrPrebuild ? <Prebuild /> : <Project />;
}
return resourceOrPrebuild ? <Prebuild /> : <Project />;
}}
/>
</Route>
Expand All @@ -459,39 +458,36 @@ function App() {
<Route
exact
path={`/t/${team.slug}/:maybeProject/:resourceOrPrebuild?`}
render={(props) => {
const { maybeProject, resourceOrPrebuild } = props.match.params;
if (maybeProject === "projects") {
return <Projects />;
}
if (maybeProject === "workspaces") {
return <Workspaces />;
}
if (maybeProject === "members") {
return <Members />;
}
if (maybeProject === "settings") {
return <TeamSettings />;
render={({ match }) => {
const { maybeProject, resourceOrPrebuild } = match.params;
switch (maybeProject) {
case "projects":
return <Projects />;
case "workspaces":
return <Workspaces />;
case "members":
return <Members />;
case "settings":
return <TeamSettings />;
case "billing":
return <TeamBilling />;
case "usage":
return <TeamUsage />;
default:
break;
}
if (maybeProject === "billing") {
return <TeamBilling />;
}
if (maybeProject === "usage") {
return <TeamUsage />;
}
if (resourceOrPrebuild === "events") {
return <Events />;
}
if (resourceOrPrebuild === "prebuilds") {
return <Prebuilds />;
}
if (resourceOrPrebuild === "settings") {
return <ProjectSettings />;
}
if (resourceOrPrebuild === "variables") {
return <ProjectVariables />;
switch (resourceOrPrebuild) {
case "events":
return <Events />;
case "prebuilds":
return <Prebuilds />;
case "settings":
return <ProjectSettings />;
case "variables":
return <ProjectVariables />;
default:
return resourceOrPrebuild ? <Prebuild /> : <Project />;
}
return resourceOrPrebuild ? <Prebuild /> : <Project />;
}}
/>
</Route>
Expand Down

0 comments on commit 907d572

Please sign in to comment.