-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from CMP26Projects/homepage-dashboards
⚛️ User Actions Component
- Loading branch information
Showing
5 changed files
with
257 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.userActions { | ||
&__container { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
gap: 10px; | ||
direction: rtl; | ||
|
||
.span-2-cols { | ||
grid-column: 1 / span 2; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,234 @@ | ||
|
||
import "../../assets/styles/components/UserActions.scss"; | ||
import Button from "./Button"; | ||
import { useSelector } from "react-redux"; | ||
|
||
const ActionRoutes = { | ||
"Assign Sector Leader": "/assign-sector-leader", | ||
"Add Sector": "/add-sector", | ||
"Add Scout": "/add-scout", | ||
Statistics: "/statistics", | ||
"Financial Management": "/financial-management", | ||
"Send Notification": "/send-notification", | ||
"Edit Scout": "/edit-scout", | ||
"Reports and Councils": "/reports-and-councils", | ||
Activities: "/activities", | ||
Sessions: "/sessions", | ||
"Start New Term": "/start-new-term", | ||
Sectors: "/sectors", | ||
"Record Captain Absence": "/record-captain-absence", | ||
"Record Scouts Absence": "/record-scouts-absence", | ||
Scores: "/scores", | ||
Sector: "/sector", | ||
}; | ||
|
||
export default function UserActions() { | ||
const { userInfo } = useSelector((state) => state.auth); | ||
const { type } = userInfo; | ||
|
||
const GeneralCaptainActions = () => { | ||
return ( | ||
<> | ||
<Button | ||
linkTo={ActionRoutes["Assign Sector Leader"]} | ||
className="Button--medium Button--primary-darker" | ||
> | ||
تعيين قائد لقطاع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Add Sector"]} | ||
className="Button--medium Button--regular" | ||
> | ||
إضافة قطاع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Add Scout"]} | ||
className="Button--medium Button--regular" | ||
> | ||
إضافة كشاف | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes.Statistics} | ||
className="Button--medium Button--regular" | ||
> | ||
الاحصائيات | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Financial Management"]} | ||
className="Button--medium Button--regular" | ||
> | ||
إدارة الماليات | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Send Notification"]} | ||
className="Button--medium Button--regular" | ||
> | ||
إرسال إشعار | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium Button--regular" | ||
> | ||
تعديل كشاف | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium Button--regular" | ||
> | ||
التقارير والمجالس | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium Button--regular" | ||
> | ||
الأنشطة | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium Button--regular" | ||
> | ||
المواضيع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium span-2-cols Button--success" | ||
> | ||
بدء فترة جديدة | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
const UnitCaptainActions = () => { | ||
return ( | ||
<> | ||
<Button | ||
linkTo={ActionRoutes["Assign Sector Leader"]} | ||
className="Button--medium Button--primary-darker" | ||
> | ||
تعيين قائد لقطاع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Statistics"]} | ||
className="Button--medium Button--regular" | ||
> | ||
الاحصائيات | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Send Notification"]} | ||
className="Button--medium Button--regular" | ||
> | ||
إرسال إشعار | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Add Scout"]} | ||
className="Button--medium Button--regular" | ||
> | ||
إضافة كشاف | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Edit Scout"]} | ||
className="Button--medium Button--regular" | ||
> | ||
تعديل كشاف | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Reports and Councils"]} | ||
className="Button--medium Button--regular" | ||
> | ||
التقارير والمجالس | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Activities"]} | ||
className="Button--medium Button--regular" | ||
> | ||
الأنشطة | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium Button--regular" | ||
> | ||
المواضيع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sectors"]} | ||
className="Button--medium span-2-cols Button--regular" | ||
> | ||
القطاعات | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Record Captain Absence"]} | ||
className="Button--medium span-2-cols Button--success" | ||
> | ||
تسجيل غياب القادة | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
const RegularCaptainActions = () => { | ||
return ( | ||
<> | ||
<Button | ||
linkTo={ActionRoutes["Statistics"]} | ||
className="Button--medium span-2-cols Button--regular" | ||
> | ||
الاحصائيات | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Edit Scout"]} | ||
className="Button--medium Button--regular" | ||
> | ||
تعديل كشاف | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Reports and Councils"]} | ||
className="Button--medium Button--regular" | ||
> | ||
التقارير والمجالس | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Activities"]} | ||
className="Button--medium Button--regular" | ||
> | ||
الأنشطة | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sessions"]} | ||
className="Button--medium Button--regular" | ||
> | ||
المواضيع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Scores"]} | ||
className="Button--medium Button--regular" | ||
> | ||
تقييم أفراد | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Sector"]} | ||
className="Button--medium Button--regular" | ||
> | ||
القطاع | ||
</Button> | ||
<Button | ||
linkTo={ActionRoutes["Record Scouts Absence"]} | ||
className="Button--medium span-2-cols Button--success" | ||
> | ||
تسجيل غياب الأفراد | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
return ( | ||
<div>UserActions</div> | ||
) | ||
<div className="userActions"> | ||
<div className="userActions__container "> | ||
{{ | ||
general: <GeneralCaptainActions />, | ||
unit: <UnitCaptainActions />, | ||
regular: <RegularCaptainActions />, | ||
}[type] || <p>لا يوجد أي إجراءات متاحة</p>} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,5 @@ VALUES | |
"[email protected]", | ||
"$2a$10$82orQ3yruIoakCWUg/29KuXBwJlZiezJzxUW.8Ek.Jvc/MPLagDYS", | ||
"male", | ||
"regular" | ||
"general" | ||
) RETURNING *; |