Skip to content

Commit 4a1fb4e

Browse files
committed
feat(dashboard): added simple dashboard
1 parent f2cd479 commit 4a1fb4e

13 files changed

Lines changed: 313 additions & 48 deletions

File tree

app/components/FileUpload/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.fileInput {
22
display: flex;
3-
width: 100%;
43
flex-direction: row;
4+
width: 100%;
55
gap: var(--go-ui-spacing-sm);
66
@media (max-width: 768px) {
77
flex-direction: column;
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,53 @@
11
.section {
22
display: flex;
33
flex-direction: row;
4+
margin-bottom: var(--go-ui-spacing-sm);
5+
background-color: var(--go-ui-color-white);
46
padding: var(--go-ui-spacing-lg) var(--go-ui-spacing-xl);
57
gap: var(--go-ui-spacing-xl);
6-
background-color: var(--go-ui-color-white);
7-
margin-bottom: var(--go-ui-spacing-sm);
8+
89
@media (max-width: 768px) {
910
flex-direction: column;
1011
gap: var(--go-ui-spacing-sm);
1112
}
13+
1214
.asterisk {
13-
color: var(--go-ui-color-primary-red);
1415
padding-left: var(--go-ui-spacing-2xs);
16+
color: var(--go-ui-color-primary-red);
1517
}
18+
1619
.label {
1720
p {
18-
font-size: var(--go-ui-font-size-xs);
1921
margin-top: var(--go-ui-spacing-2xs);
22+
font-size: var(--go-ui-font-size-xs);
2023
}
24+
2125
flex: 1;
2226
}
27+
2328
.input {
29+
display: flex;
2430
flex: 1;
25-
gap: var(--go-ui-spacing-xl);
2631
flex-wrap: wrap;
27-
display: flex;
2832
justify-content: center;
29-
> * {
33+
gap: var(--go-ui-spacing-xl);
34+
35+
>* {
3036
flex: 1;
3137
}
38+
3239
@media (max-width: 768px) {
33-
flex-direction: column;
3440
align-items: stretch;
41+
flex-direction: column;
3542
justify-content: center;
3643
gap: var(--go-ui-spacing-sm);
3744
}
45+
3846
button {
3947
display: flex;
4048
align-items: center;
41-
justify-content: center;
4249
flex: none;
50+
justify-content: center;
4351
}
4452
}
45-
}
53+
}

app/components/Navigation/styles.module.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.nav {
22
border-right: 2px solid var(--go-ui-color-gray-20);
3-
height: 100%;
3+
padding-right: 2px;
44
min-width: 320px;
5+
height: 100%;
56
overflow-x: hidden;
6-
padding-right: 2px;
77
.nav {
88
border: none;
99
padding-right: 0;
@@ -24,10 +24,10 @@
2424
.routeLink {
2525
border-right: 2px solid var(--go-ui-color-gray-20);
2626
border-bottom: 2px solid var(--go-ui-color-gray-20);
27+
padding: var(--go-ui-spacing-lg) var(--go-ui-spacing-2xl);
2728
&:hover {
2829
color: var(--go-ui-color-primary-red);
2930
}
30-
padding: var(--go-ui-spacing-lg) var(--go-ui-spacing-2xl);
3131
}
3232

3333
.activeRoute {

app/components/Page/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
display: flex;
33
flex-direction: row;
44
flex-grow: 1;
5+
background: var(--go-ui-color-gray-10);
56
height: 100%;
67
overflow: hidden;
7-
background: var(--go-ui-color-gray-10);
88
.leftPane {
99
display: flex;
1010
flex-direction: column;

app/components/RichTextEditor/styles.module.css

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
.editor {
22
display: flex;
3+
position: relative;
34
flex-direction: row;
4-
background-color: var(--color-background);
5-
font-size: var(--font-size-lg);
6-
gap: var(--go-ui-spacing-md);
75
border: 1px solid var(--go-ui-color-gray-20);
8-
position: relative;
96
border-radius: var(--go-ui-spacing-sm);
107
min-height: var(--go-ui-width-min-modal);
11-
> * {
8+
gap: var(--go-ui-spacing-md);
9+
10+
>* {
1211
flex: 1;
1312
}
1413
}
@@ -27,14 +26,16 @@ h6 {
2726
.editor ol {
2827
padding-left: var(--go-ui-spacing-xl);
2928
}
29+
3030
.editor li {
3131
margin: 4px 0;
3232
}
3333

3434
.editor a {
3535
text-decoration: underline;
3636
color: var(--go-ui-color-dark-blue-20);
37+
3738
&:hover {
3839
color: var(--go-ui-color-dark-blue-30);
3940
}
40-
}
41+
}

app/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ a {
4141
}
4242

4343
::-webkit-scrollbar-track {
44-
background: transparent;
4544
border-radius: 10px;
45+
background: transparent;
4646
}
4747

4848
::-webkit-scrollbar-thumb {
49-
background-color: var(--go-ui-color-gray-20);
5049
border-radius: 10px;
50+
background-color: var(--go-ui-color-gray-20);
5151
}
5252

5353
::-webkit-scrollbar-thumb:hover {

app/views/Blog/BlogForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function BlogForm() {
209209
</Heading>
210210
</FormSection>
211211
)}
212-
<FormSection label="Title*" description="Enter the title name of the Blog" withAsteriskOnTitle>
212+
<FormSection label="Title" description="Enter the title name of the Blog" withAsteriskOnTitle>
213213
<TextInput
214214
name="title"
215215
value={value.title}

app/views/Highlight/HighlightForm/styles.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
.actionLinkRow {
3-
width: 100%;
43
display: flex;
5-
gap: var(--go-ui-spacing-sm);
64
align-items: center;
75
margin-bottom: var(--go-ui-spacing-sm);
6+
width: 100%;
7+
gap: var(--go-ui-spacing-sm);
88
> * {
99
flex-grow: 1;
1010
}

app/views/Home/index.tsx

Lines changed: 161 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,168 @@
1-
// import { gql } from 'urql';
1+
import { use } from 'react';
2+
import {
3+
FaFileAlt,
4+
FaFileAudio,
5+
FaHighlighter,
6+
FaMoneyCheck,
7+
FaProjectDiagram,
8+
FaQuestionCircle,
9+
FaRegNewspaper,
10+
FaSuitcase,
11+
FaThinkPeaks,
12+
FaUserFriends,
13+
FaWarehouse,
14+
FaWindowMaximize,
15+
} from 'react-icons/fa';
16+
import { useNavigate } from 'react-router';
17+
import {
18+
Button,
19+
Container,
20+
Heading,
21+
} from '@ifrc-go/ui';
22+
23+
import Page from '#components/Page';
24+
import UserContext from '#contexts/UserContext';
25+
import { useCountsQuery } from '#generated/types/graphql';
226

327
import styles from './styles.module.css';
428

5-
function Home() {
6-
// const ORGANIZATION_LIST_QUERY = gql`
7-
// query DepartmentList {
8-
// departments {
9-
// title
10-
// slug
11-
// id
12-
// description
13-
// }
14-
// }
15-
// `;
29+
function Dashboards() {
30+
const { user } = use(UserContext);
31+
const [{ data }] = useCountsQuery();
32+
const navigate = useNavigate();
33+
34+
const card = [
35+
{
36+
title: 'Featured blogs',
37+
count: data?.blogs.totalCount || 0,
38+
icon: <FaFileAlt />,
39+
addLink: '/blog/add',
40+
},
41+
{
42+
title: 'Departments',
43+
count: data?.departments.totalCount || 0,
44+
icon: <FaMoneyCheck />,
45+
addLink: '/departments/add',
46+
47+
},
48+
{
49+
title: 'FAQs',
50+
count: data?.faqs.totalCount || 0,
51+
icon: <FaQuestionCircle />,
52+
addLink: '/faqs/add',
53+
},
54+
{
55+
title: 'Highlights',
56+
count: data?.highlights.totalCount || 0,
57+
icon: <FaHighlighter />,
58+
addLink: '/highlights/add',
59+
},
60+
{
61+
title: 'Vacancies',
62+
count: data?.jobVacancies.totalCount || 0,
63+
icon: <FaSuitcase />,
64+
addLink: '/job-vacancies/add',
65+
},
66+
{
67+
title: 'News',
68+
count: data?.news.totalCount || 0,
69+
icon: <FaRegNewspaper />,
70+
addLink: '/news/add',
71+
},
72+
{
73+
title: 'Partners',
74+
count: data?.partners.totalCount || 0,
75+
icon: <FaUserFriends />,
76+
addLink: '/partners/add',
77+
},
78+
{
79+
title: 'Radio Programs',
80+
count: data?.radioProgram.totalCount || 0,
81+
icon: <FaFileAudio />,
82+
addLink: '/radio-programs/add',
83+
},
84+
{
85+
title: 'Strategic Directives',
86+
count: data?.strategicDirectives.totalCount || 0,
87+
icon: <FaThinkPeaks />,
88+
addLink: '/strategic-directives/add',
89+
},
90+
{
91+
title: 'Resources',
92+
count: data?.resources.totalCount || 0,
93+
icon: <FaWarehouse />,
94+
addLink: '/resources/add',
95+
},
96+
{
97+
title: 'Projects',
98+
count: data?.projects.totalCount || 0,
99+
icon: <FaProjectDiagram />,
100+
addLink: '/projects/add',
101+
},
102+
{
103+
title: 'Procurements',
104+
count: data?.procurements.totalCount || 0,
105+
icon: <FaWindowMaximize />,
106+
addLink: '/procurements/add',
107+
},
108+
];
109+
16110
return (
17-
<div className={styles.homePage}>
18-
Home
19-
</div>
111+
<Page className={styles.page}>
112+
<Container
113+
heading="Dashboards"
114+
headingLevel={1}
115+
headerDescription={(
116+
<>
117+
Welcome back
118+
{' '}
119+
<strong>
120+
{user?.firstName}
121+
{' '}
122+
{user?.lastName}
123+
</strong>
124+
{' '}
125+
to the NRC CMS Dashboard.
126+
<br />
127+
Use the navigation menu to access different sections of the CMS.
128+
</>
129+
)}
130+
childrenContainerClassName={styles.childContainer}
131+
className={styles.container}
132+
>
133+
<div className={styles.content}>
134+
<div className={styles.cards}>
135+
{card.map((item) => (
136+
<div key={item.title} className={styles.card}>
137+
<Heading level={6}>
138+
{item.title}
139+
</Heading>
140+
<div className={styles.cardCount}>
141+
{item.icon}
142+
{item.count}
143+
</div>
144+
</div>
145+
))}
146+
</div>
147+
<div className={styles.cards}>
148+
<div className={styles.card}>
149+
<Heading level={3}>Quick Action</Heading>
150+
{card.map((item) => (
151+
<div key={item.title}>
152+
<Button variant="secondary" name={undefined} onClick={() => navigate(item.addLink)}>
153+
New
154+
{' '}
155+
{item.title}
156+
</Button>
157+
</div>
158+
))}
159+
</div>
160+
</div>
161+
</div>
162+
163+
</Container>
164+
</Page>
20165
);
21166
}
22167

23-
export default Home;
168+
export default Dashboards;

0 commit comments

Comments
 (0)