Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit b4e7046

Browse files
authored
EVG-17523 Set up route infrastructure (#10)
1 parent b476cff commit b4e7046

File tree

15 files changed

+198
-10
lines changed

15 files changed

+198
-10
lines changed

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ module.exports = {
4141
},
4242
rules: {
4343
// Rules for ESLint.
44+
"arrow-body-style": [
45+
errorIfStrict,
46+
"as-needed",
47+
{
48+
requireReturnForObjectLiteral: false,
49+
},
50+
],
4451
"consistent-return": OFF,
4552
curly: [errorIfStrict, "multi-line"],
4653
eqeqeq: [errorIfStrict, "always", { null: "ignore" }],

cypress/integration/app.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ describe("Basic app test", () => {
55
cy.visit("/");
66
});
77

8-
it("should be able to see the search bar", () => {
9-
cy.dataCy("searchbar-select").should("exist");
10-
cy.dataCy("searchbar-input").should("exist");
8+
it("should be able to see the loading page", () => {
9+
cy.contains("I am the loading page");
1110
});
1211
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file can be deleted later.
2+
3+
describe("Basic evergreen log view", () => {
4+
beforeEach(() => {
5+
cy.visit("/evergreen/task_0/0/tasks");
6+
});
7+
8+
it("should be able to see the log page", () => {
9+
cy.contains("EVERGREEN_TASK_LOGS").should("be.visible");
10+
});
11+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file can be deleted later.
2+
3+
describe("Basic evergreen test log view", () => {
4+
beforeEach(() => {
5+
cy.visit("/test/task_0/0/test_0");
6+
});
7+
8+
it("should be able to see the log page", () => {
9+
cy.contains("EVERGREEN_TEST_LOGS").should("be.visible");
10+
});
11+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file can be deleted later.
2+
3+
describe("Basic resmoke log view", () => {
4+
beforeEach(() => {
5+
cy.visit("/resmoke/build_0/test_0");
6+
});
7+
8+
it("should be able to see the log page", () => {
9+
cy.contains("RESMOKE_LOGS").should("be.visible");
10+
});
11+
});

src/App.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
import SearchBar from "components/SearchBar";
1+
import { Global, css } from "@emotion/react";
2+
import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
3+
import NavBar from "components/NavBar";
4+
import Content from "pages/Content";
25

3-
const App = () => {
4-
return <SearchBar />;
5-
};
6+
const globalStyles = css`
7+
background-color: white;
8+
body {
9+
margin: 0;
10+
}
11+
`;
12+
13+
const App = () => (
14+
<>
15+
<Global styles={globalStyles} />
16+
<Router>
17+
<NavBar />
18+
<Routes>
19+
<Route element={<Content />} path="/*" />
20+
</Routes>
21+
</Router>
22+
</>
23+
);
624

725
export default App;

src/components/NavBar/index.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Styled from "@emotion/styled";
2+
import { palette } from "@leafygreen-ui/palette";
3+
import { size } from "constants/tokens";
4+
5+
const { gray, white } = palette;
6+
7+
const NavBar: React.FC = () => <Container>OUR TRUSTY NAVBAR</Container>;
8+
9+
const Container = Styled.nav`
10+
align-items: center;
11+
background-color: ${white};
12+
border-bottom: 1px solid ${gray.light2};
13+
display: flex;
14+
height: ${size.xl};
15+
padding: 0 ${size.s};
16+
`;
17+
18+
export default NavBar;
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ComponentMeta } from "@storybook/react";
1+
import { ComponentMeta, ComponentStory } from "@storybook/react";
22

33
import SearchBar from ".";
44

@@ -7,6 +7,13 @@ export default {
77
component: SearchBar,
88
} as ComponentMeta<typeof SearchBar>;
99

10-
export const Default = () => <SearchBar disabled={false} />;
10+
// 👇 We create a “template” of how args map to rendering
11+
const Template: ComponentStory<typeof SearchBar> = (args) => (
12+
<SearchBar {...args} />
13+
);
1114

12-
export const Disabled = () => <SearchBar disabled />;
15+
export const Default = Template.bind({});
16+
17+
Default.args = {
18+
disabled: false,
19+
};

src/constants/enums.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enum LogTypes {
2+
EVERGREEN_TASK_LOGS = "EVERGREEN_TASK_LOGS",
3+
EVERGREEN_TEST_LOGS = "EVERGREEN_TEST_LOGS",
4+
RESMOKE_LOGS = "RESMOKE_LOGS",
5+
}
6+
7+
export { LogTypes };

src/constants/routes.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const paths = {
2+
home: "/",
3+
evergreenLogs: "/evergreen",
4+
testLogs: "/test",
5+
resmokeLogs: "/resmoke",
6+
};
7+
8+
const slugs = {
9+
taskID: ":task_id",
10+
execution: ":execution",
11+
origin: ":origin",
12+
testID: ":test_id",
13+
buildID: ":build_id",
14+
};
15+
16+
const routes = {
17+
root: paths.home,
18+
evergreenLogs: `${paths.evergreenLogs}/${slugs.taskID}/${slugs.execution}/${slugs.origin}`,
19+
testLogs: `${paths.testLogs}/${slugs.taskID}/${slugs.execution}/${slugs.testID}`,
20+
resmokeLogs: `${paths.resmokeLogs}/${slugs.buildID}/${slugs.testID}`,
21+
};
22+
23+
export default routes;

0 commit comments

Comments
 (0)