Skip to content

Commit

Permalink
fixed ui changes (#13)
Browse files Browse the repository at this point in the history
* fix login form and cca uiux.

* Remove zone identifier.

* fixed layout issues

* fixed icon

* Add all the query routes

* Updating bidding form

* oMerge https://github.com/eusoff-hackers/eusoff-frontend into fix/layout

* added skeleton for bidding table

* Add logic for rendering

* modified a lot of code

* displaying user info

* added more design changes

* fixed eligible biddings

* more changes

---------

Co-authored-by: Juan Carlo Vieri <[email protected]>
Co-authored-by: Aaron <[email protected]>
  • Loading branch information
3 people authored Oct 14, 2024
1 parent 81df05b commit 608719e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/app/components/BiddingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const BiddingTable: React.FC<BiddingList> = ({ userBids, refetchUserBids, biddin
<p className="pl-2">Ensure you click submit to confirm changes</p>
</div>
{/* {biddings.length == 0 ? (
{/* {biddings.length == 0 ? (
<></>
) : (
Expand Down Expand Up @@ -177,6 +178,7 @@ const BiddingTable: React.FC<BiddingList> = ({ userBids, refetchUserBids, biddin
<button
className="rounded bg-red-100 px-3 py-1 text-red-500 hover:bg-red-200 focus:outline-none"
// onClick={() => deleteBid(index)}
// onClick={() => deleteBid(index)}
>
Delete
</button>
Expand Down Expand Up @@ -259,7 +261,7 @@ const BiddingTable: React.FC<BiddingList> = ({ userBids, refetchUserBids, biddin
<h1 className="text-l mb-4 font-bold"> Eligible Bidding Numbers : </h1>

<div className="grid grid-cols-2 gap-2 sm:grid-cols-5 md:grid-cols-8 lg:grid-cols-10">
{Array.from({ length: 100 }, (_, i) => i + 1).map(number => {
{Array.from({ length: 99 }, (_, i) => i + 1).map(number => {
const isEligible = userEligibleBids !== undefined ? userEligibleBids.jerseys.includes(number) : false; // Check if the number is eligible
return (
<Button
Expand Down
25 changes: 15 additions & 10 deletions src/app/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ export default function NavBar() {
route.push("/");
};

return (
<nav className="w-full bg-gray-800 p-5 text-white lg:min-h-screen">
<p className="mb-5 text-2xl">Dashboard</p>
<ul className="space-y-2">
<li className="hover:translate-x-1">
/*
<li className="hover:translate-x-1">
<Link className="flex items-center gap-3 py-2" href="/dashboard/profile">
<svg
className="h-5 w-5"
Expand All @@ -56,9 +53,12 @@ export default function NavBar() {
</svg>
<span>Profile</span>
</Link>
</li>
</li>
<li className="hover:translate-x-1">
<Link className="flex items-center gap-3 py-2" href="/dashboard/jersey">
<Link className="flex items-center gap-3 py-2" href="/dashboard/instructions">
<svg
className="h-5 w-5"
fill="none"
Expand All @@ -76,12 +76,17 @@ export default function NavBar() {
<line x1="3" y1="11" x2="17" y2="11" />
<line x1="3" y1="15" x2="17" y2="15" />
</svg>
<span>Jersey Bidding</span>
<span>CCA Booklet</span>
</Link>
</li>
*/

return (
<nav className="w-full bg-gray-800 p-5 text-white lg:min-h-screen">
<p className="mb-5 text-2xl">Dashboard</p>
<ul className="space-y-2">
<li className="hover:translate-x-1">
<Link className="flex items-center gap-3 py-2" href="/dashboard/instructions">
<Link className="flex items-center gap-3 py-2" href="/dashboard/jersey">
<svg
className="h-5 w-5"
fill="none"
Expand All @@ -99,7 +104,7 @@ export default function NavBar() {
<line x1="3" y1="11" x2="17" y2="11" />
<line x1="3" y1="15" x2="17" y2="15" />
</svg>
<span>CCA Booklet</span>
<span>Jersey Bidding</span>
</Link>
</li>
<li className="hover:translate-x-1">
Expand Down
42 changes: 29 additions & 13 deletions src/app/dashboard/jersey/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,36 @@ const Jersey: React.FC = () => {
};

// Does a call for User's bidding info
// const getUserBiddings = async () => {
// try {
// const response = await axios.get(`${process.env.NEXT_PUBLIC_BACKEND_URL}/jersey/info`);
const getUserBiddings = async () => {
try {
const response = await axios.get(`${process.env.NEXT_PUBLIC_BACKEND_URL}/jersey/info`);

// console.log("response", response.data.data);
console.log("response", response.data.data);

if (response.data.success) {
console.log("This is eligible bids" + JSON.stringify(response.data.data));
return response.data.data;
}
} catch (error) {
console.error("Error during getting user bids", error);
}
};

const getEligibleNumbers = async () => {
try{
const response = await axios.get(`${process.env.NEXT_PUBLIC_BACKEND_URL}/jersey/eligible`);

console.log("response", response.data.data);

if (response.data.success) {
console.log("This is eligible numbers" + JSON.stringify(response.data.data));
return response.data.data;
}
} catch (error) {
console.error("Error during getting user bids", error);
}
}

// if (response.data.success) {
// console.log("This is eligible bids" + JSON.stringify(response.data.data));
// return response.data.data;
// }
// } catch (error) {
// console.error("Error during getting user bids", error);
// }
// };

const {
data: bids,
Expand Down Expand Up @@ -147,7 +163,7 @@ const Jersey: React.FC = () => {
)}
</div>
);
return <Loading />;

};

export default Jersey;
10 changes: 10 additions & 0 deletions src/app/dashboard/jersey/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,40 @@ export interface UserInfo {
points: number;
isAllocated: boolean;
jersey?: JerseyType; // Only present if isAllocated is true
<<<<<<< HEAD
teams: Team[];
=======
teams: TeamContainer[];
>>>>>>> 81df05bbaae3cbaa3ef923043f4dd1a0af505bbf
}

export interface JerseyType {
number: number;
quota: Quota;
}

<<<<<<< HEAD
=======
export interface EligibleBids {
jerseys: number[];
}

>>>>>>> 81df05bbaae3cbaa3ef923043f4dd1a0af505bbf
export interface Quota {
male: number;
female: number;
}

interface Team {
name: string;
<<<<<<< HEAD
=======
shareable: boolean;
}

interface TeamContainer {
team: Team;
>>>>>>> 81df05bbaae3cbaa3ef923043f4dd1a0af505bbf
}

interface Bid {
Expand Down

0 comments on commit 608719e

Please sign in to comment.