Skip to content

Commit

Permalink
Remove unused code (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
Winston-Hsiao authored Nov 18, 2024
1 parent b3315be commit bb7b7a2
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 85 deletions.
12 changes: 0 additions & 12 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ form button:hover {
border-color: white;
}

.about-section {
max-width: 800px;
margin: 2em auto;
text-align: left;
padding: 0 1em;
}

.about-section p {
margin-bottom: 1em;
line-height: 1.6;
}

@media (max-width: 600px) {
.about-section {
font-size: 0.9em;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/modals/EditAddressModal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from "react";

import { Input } from "@/components/ui/Input/Input";
import Modal from "@/components/ui/Modal";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { useAlertQueue } from "@/hooks/useAlertQueue";
import { useAuthentication } from "@/hooks/useAuth";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/modals/EditRobotModal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useCallback, useEffect, useState } from "react";

import { Input } from "@/components/ui/Input/Input";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { ApiError } from "@/lib/types/api";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/modals/RegisterRobotModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { useState } from "react";
import { FaPlus } from "react-icons/fa";
import { useNavigate } from "react-router-dom";

import { Input } from "@/components/ui/Input/Input";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { useAlertQueue } from "@/hooks/useAlertQueue";
Expand Down
41 changes: 7 additions & 34 deletions frontend/src/components/orders/OrderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import type { OrderWithProduct } from "@/lib/types/orders";
import {
activeStatuses,
canModifyStatuses,
orderStatuses,
redStatuses,
} from "@/lib/types/orders";
import { formatPrice } from "@/lib/utils/formatNumber";
import { normalizeStatus } from "@/lib/utils/formatString";

Expand All @@ -21,37 +27,6 @@ enum OrderStatus {
DELIVERED = 4,
}

const orderStatuses = [
"processing",
"in_development",
"being_assembled",
"shipped",
"delivered",
"awaiting_final_payment",
"preorder_placed",
"cancelled",
"refunded",
"failed",
];

const activeStatuses = [
"preorder_placed",
"processing",
"in_development",
"being_assembled",
"shipped",
"awaiting_final_payment",
];

const redStatuses = ["cancelled", "refunded", "failed"];
const canModifyStatuses = [
"preorder_placed",
"processing",
"in_development",
"being_assembled",
"awaiting_final_payment",
];

const OrderCard: React.FC<{ orderWithProduct: OrderWithProduct }> = ({
orderWithProduct: initialOrderWithProduct,
}) => {
Expand Down Expand Up @@ -265,9 +240,7 @@ const OrderCard: React.FC<{ orderWithProduct: OrderWithProduct }> = ({

{isRedStatus && (
<p className="text-red-600 font-semibold mb-4">
{order.status === "failed"
? "This order has failed."
: `This order has been ${normalizeStatus(order.status)}.`}
This order has been {normalizeStatus(order.status)}.
</p>
)}

Expand Down
24 changes: 0 additions & 24 deletions frontend/src/components/ui/input.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/gen/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ export interface components {
* Status
* @enum {string}
*/
status: "processing" | "in_development" | "being_assembled" | "shipped" | "delivered" | "preorder_placed" | "awaiting_final_payment" | "cancelled" | "refunded" | "failed";
status: "processing" | "in_development" | "being_assembled" | "shipped" | "delivered" | "preorder_placed" | "awaiting_final_payment" | "cancelled" | "refunded";
/** Price Amount */
price_amount: number;
/** Currency */
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/lib/cn.ts

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/src/lib/types/colors.ts

This file was deleted.

30 changes: 30 additions & 0 deletions frontend/src/lib/types/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,33 @@ export type ProductInfo = {
images: string[];
metadata: Record<string, string>;
};

export const orderStatuses = [
"processing",
"in_development",
"being_assembled",
"shipped",
"delivered",
"awaiting_final_payment",
"preorder_placed",
"cancelled",
"refunded",
];

export const activeStatuses = [
"preorder_placed",
"processing",
"in_development",
"being_assembled",
"shipped",
"awaiting_final_payment",
];

export const redStatuses = ["cancelled", "refunded"];
export const canModifyStatuses = [
"preorder_placed",
"processing",
"in_development",
"being_assembled",
"awaiting_final_payment",
];
1 change: 0 additions & 1 deletion store/app/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ def create(cls, user_id: str, listing_id: str, is_upvote: bool) -> Self:
"awaiting_final_payment",
"cancelled",
"refunded",
"failed",
]

InventoryType = Literal["finite", "preorder"]
Expand Down

0 comments on commit bb7b7a2

Please sign in to comment.