Skip to content

Commit

Permalink
Styling Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alderwhiteford committed Dec 8, 2023
1 parent c2c6f61 commit 4b896e2
Show file tree
Hide file tree
Showing 60 changed files with 10,321 additions and 5,999 deletions.
11,695 changes: 7,983 additions & 3,712 deletions frontend/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createPriceEstimationApi, createSlicerApi } from "./slicerAPI";
import { createUserApi } from "./userAPI";

const API_BASE_URL = "http://localhost:3000/api";
const MICRO_SERVICE_URL = "http://44.215.25.156:3000/api"
const MICRO_SERVICE_URL = "http://44.215.25.156:3000/api";

const authApi = createAuthApi(API_BASE_URL);
const userApi = createUserApi(API_BASE_URL);
Expand Down
42 changes: 21 additions & 21 deletions frontend/src/api/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,33 @@ export type SlicerData = {
maxy: number;
maxz: number;
targetMachineName: string;
}
};

export type PriceEstimation = {
shipping: boolean,
filamentType: string,
slices: SlicerData[],
}
shipping: boolean;
filamentType: string;
slices: SlicerData[];
};

export type EstimateBreakdown = {
file: string,
baseCost: number,
timeCost: number,
filamentCost: number,
shippingCost: number,
producerSubtotal: number,
producerFee: number,
producerTotal: number,
taxCost: number,
stripeCost: number,
voxetiCost: number,
total: number,
}
file: string;
baseCost: number;
timeCost: number;
filamentCost: number;
shippingCost: number;
producerSubtotal: number;
producerFee: number;
producerTotal: number;
taxCost: number;
stripeCost: number;
voxetiCost: number;
total: number;
};

export type VoxetiJob = {
id: string,
job: Job,
}
id: string;
job: Job;
};

export type CheckoutState = {
prices: EstimateBreakdown[];
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/api/authAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export const createAuthApi = (baseUrl: string) =>
baseUrl: `${baseUrl}/auth`,
credentials: "include",
prepareHeaders: (headers, { getState }) => {
const token = (getState() as RootState).user.csrfToken
const token = (getState() as RootState).user.csrfToken;
if (token) {
headers.set("Csrftoken", token)
headers.set("Csrftoken", token);
}
return headers
}
return headers;
},
}),
endpoints: (builder) => ({
login: builder.mutation<UserSliceState, UserCredentials>({
Expand All @@ -42,8 +42,8 @@ export const createAuthApi = (baseUrl: string) =>
authenticate: builder.query({
query: () => ({
method: "POST",
url: "/authenticate"
})
})
url: "/authenticate",
}),
}),
}),
});
8 changes: 4 additions & 4 deletions frontend/src/api/designAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export const createDesignApi = (baseUrl: string) =>
baseUrl: `${baseUrl}/designs`,
credentials: "include",
prepareHeaders: (headers, { getState }) => {
const token = (getState() as RootState).user.csrfToken
const token = (getState() as RootState).user.csrfToken;
if (token) {
headers.set("Csrftoken", token)
headers.set("Csrftoken", token);
}
return headers
}
return headers;
},
}),
endpoints: (builder) => ({
uploadDesign: builder.mutation<Design[], FormData>({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/jobAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const createJobApi = (baseUrl: string) =>
>({
query: ({ producerId, page, limit, filter, sort }) =>
`/recommendations/${producerId}?page=${page}&limit=${limit}&filter=${filter.join(
","
",",
)}&sort=${sort}`,
}),

Expand Down
8 changes: 4 additions & 4 deletions frontend/src/api/slicerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const createPriceEstimationApi = (baseUrl: string) =>
baseUrl: `${baseUrl}/slicer`,
credentials: "include",
prepareHeaders: (headers, { getState }) => {
const token = (getState() as RootState).user.csrfToken
const token = (getState() as RootState).user.csrfToken;
if (token) {
headers.set("Csrftoken", token)
headers.set("Csrftoken", token);
}
return headers
}
return headers;
},
}),
endpoints: (builder) => ({
estimatePrices: builder.mutation<EstimateBreakdown[], PriceEstimation>({
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/api/userAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export const createUserApi = (baseUrl: string) =>
baseUrl: `${baseUrl}/users`,
credentials: "include",
prepareHeaders: (headers, { getState }) => {
const token = (getState() as RootState).user.csrfToken
const token = (getState() as RootState).user.csrfToken;
if (token) {
headers.set("Csrftoken", token)
headers.set("Csrftoken", token);
}
return headers
}
return headers;
},
}),
endpoints: (builder) => ({
createUser: builder.mutation<User, User>({
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/Auth/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ export default function Auth({ children, authRoute }: AuthProps) {
useEffect(() => {
if (authRoute) {
userId == "" && router.navigate({ to: "/login" });
}
else {
userId !== "" && router.navigate({ to: '/jobs' })
} else {
userId !== "" && router.navigate({ to: "/jobs" });
}
}, [authRoute, userId]);

Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/Button/Button.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ export interface StyledButtonProps {
type?: "submit" | "button";
icon?: string;
disabled?: boolean;
size?: 'sm' | 'md' | 'lg';
color: 'primary' | 'seconday' | 'producer'| 'designer' | 'delete' | 'success';
size?: "sm" | "md" | "lg";
color:
| "primary"
| "seconday"
| "producer"
| "designer"
| "delete"
| "success";
onClick?: () => void;
}
37 changes: 22 additions & 15 deletions frontend/src/components/Jobs/AvatarCell.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
import { Avatar } from "@mui/material";

type ProducerCellProps = {
avatar?: string,
firstName?: string,
lastName?: string,
userType: 'designer' | 'producer',
imageOnly: boolean,
size: number,
}
avatar?: string;
firstName?: string;
lastName?: string;
userType: "designer" | "producer";
imageOnly: boolean;
size: number;
};

export default function AvatarCell({ firstName, lastName, userType, imageOnly, size } : ProducerCellProps) {
export default function AvatarCell({
firstName,
lastName,
userType,
imageOnly,
size,
}: ProducerCellProps) {
const avatarOutlineColor = {
designer: '!bg-designer',
producer: '!bg-producer',
}
designer: "!bg-designer",
producer: "!bg-producer",
};

return (
<div className="flex items-center text-base">
<Avatar
sx={{
width: size,
height: size,
marginRight: '20px'
marginRight: "20px",
}}
className={avatarOutlineColor[userType]}
>
Expand All @@ -42,9 +48,10 @@ export default function AvatarCell({ firstName, lastName, userType, imageOnly, s
</Avatar>
</Avatar>
</Avatar>
{!imageOnly && ((firstName && lastName)
? firstName + " " + lastName
: userType === "producer"
{!imageOnly &&
(firstName && lastName
? firstName + " " + lastName
: userType === "producer"
? "Awaiting Acceptance"
: "User Not Found")}
</div>
Expand Down
Loading

0 comments on commit 4b896e2

Please sign in to comment.