Skip to content

adding pr from hackathon repo #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ A website template for hackathons run by [IEEE University of Toronto Student Bra
- Kenny Cui
- Himanish Jindal
- Abubukker Chaudhary
- Natalie Chan

## Contents
- [Requirements](#requirements)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
GeneralReturnTable,
} from "components/general/OrderTables/OrderTables";
import PopupModal from "components/general/PopupModal/PopupModal";
import { Link } from "react-router-dom";
import { sortPendingOrders, sortReturnedOrders } from "api/helpers";
import { sortCheckedOutOrders } from "api/helpers";

Expand Down Expand Up @@ -183,17 +184,24 @@ export const CheckedOutTables = () =>
{row.quantityGranted}
</TableCell>
<TableCell align="right">
{/* TODO: Add back in when incident reports are being used*/}
{/*<Button*/}
{/* color="secondary"*/}
{/* size="small"*/}
{/* onClick={() => {*/}
{/* reportIncident(row.id);*/}
{/* push("/incident-form");*/}
{/* }}*/}
{/*>*/}
{/* Report broken/lost*/}
{/*</Button>*/}
<Link
to={`/incident-form?data=${JSON.stringify(
row
)}`}
>
<Button
color="secondary"
size="small"
onClick={() => {
console.log(
"reporting incident",
row.id
);
}}
>
Report broken/lost
</Button>
</Link>
</TableCell>
</TableRow>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@
}
}

.titleChip {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin: 20px 0 5px 0;

@include responsive(sm-down) {
width: 100%;
flex-direction: column;
justify-content: flex-start;
}
}

.titleChipText {
margin-bottom: 4px;
}

.itemImg {
height: 80px;
width: 80px;
Expand Down Expand Up @@ -70,11 +88,6 @@
}
}

.chipPadding {
position: relative;
left: 630px;
}

.noWrap {
white-space: nowrap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,41 +96,28 @@ export const GeneralOrderTableTitle = ({
updatedTime,
additionalChipFormatting,
}: GeneralOrderTableTitleProps) => (
<Container className={styles.titleChip} maxWidth={false} disableGutters={true}>
<div className={styles.titleChip}>
<Typography variant="h2" className={styles.titleChipText}>
Order #{orderId}
</Typography>

{orderStatus && (
<Container
className={styles.titleChipSpace}
maxWidth={false}
disableGutters={true}
>
<ChipStatus status={orderStatus} />
</Container>
)}
{orderStatus && <ChipStatus status={orderStatus} />}

{createdTime && updatedTime ? (
<Container>
<div style={{ alignSelf: "flex-end" }}>
<Chip
label={[<b>Created at: </b>, formatDateTime(createdTime)]}
icon={<EditIcon />}
className={`${styles.chipPurple} ${styles.chip} ${
additionalChipFormatting ? styles.chipPadding : ""
}`}
className={`${styles.chipPurple} ${styles.chip}`}
/>
{" "}
<Chip
label={[<b>Updated at: </b>, formatDateTime(updatedTime)]}
icon={<UpdateIcon />}
className={`${styles.chipBlue} ${styles.chip} ${
additionalChipFormatting ? styles.chipPadding : ""
}`}
className={`${styles.chipBlue} ${styles.chip}`}
/>
</Container>
</div>
) : null}
</Container>
</div>
);

export const GeneralPendingTable = ({
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@import "assets/abstracts/mixins.scss";
@import "assets/abstracts/variables.scss";

.arrowIcon {
width: 50px;
height: 50px;
padding: 10px;
align-self: flex-start;

transform: translateX(0px), scale(1);
transition: transform ease-in-out 300ms;

&:hover {
transform: translateX(-10px);
transition: transform ease-in-out 300ms;
}

&:active {
transform: scale(0.8);
transition: transform 300ms;
}
}

.formContainer {
display: flex;
flex-direction: column;
width: max(40vw, 640px);

@include responsive(md-down) {
width: 100%;
}
}

.formComponentContainer {
all: unset;
padding-bottom: 20px;
}

.card {
align-self: center;
}

.cardContent {
padding: 20px;
}

.pageContent {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
}

.dropdown {
width: 200px;

@include responsive(md-down) {
width: 30%;
}
}

.textboxFill {
width: 100%;
}

.submitButton {
align-self: center;
width: fit-content;
margin-top: 10px;
}

.titleMargin {
margin-bottom: 20px;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { render, screen } from "testing/utils"; // Import your testing utilities here
import IncidentForm from "./IncidentForm";
import configureStore, { MockStore } from "redux-mock-store";

describe("IncidentForm", () => {
const mockStore = configureStore<any>([]);
let store: MockStore<any>;

beforeEach(() => {
store = mockStore({
yourReducerKey: {
id: 10,
quantityRequested: 3,
quantityGranted: 2,
},
});
});

it("renders correctly when searchParams is empty", () => {
render(<IncidentForm />);

// Assert that the component renders nothing when searchParams is empty
expect(screen.queryByText("Item Incident Form")).toBeNull(); // Update the text according to your component's content
});

it("renders IncidentFormRender when searchParams is not empty", () => {
const mockSearchParams: any = {
get: jest.fn(() =>
JSON.stringify({ id: 10, quantityRequested: 3, quantityGranted: 2 })
),
toString: jest.fn(() => "mockQueryString"),
};

jest.spyOn(global, "URLSearchParams").mockImplementation(
() => mockSearchParams
);

render(<IncidentForm />);

// Assert that mockSearchParams methods are called
expect(mockSearchParams.toString).toHaveBeenCalled();
expect(mockSearchParams.get).toHaveBeenCalledWith("data");

// Assert that the component renders IncidentFormRender
expect(screen.queryByText("Item Incident Form")).toBeInTheDocument(); // Update the text according to your component's content

// Renders all form components
const radios = screen.getAllByRole("radio");
const dropdown = screen.getByTestId("qty-dropdown");
const textareas = screen.getAllByRole("textbox");

expect(radios).toHaveLength(3); // three radio buttons
expect(dropdown).toBeInTheDocument(); // one dropdown
expect(textareas).toHaveLength(3); // three text inputs

// Renders submit button
const submitButton = screen.getByRole("button", { name: "Submit" });
expect(submitButton).toBeInTheDocument();
});
});
Loading