-
Notifications
You must be signed in to change notification settings - Fork 40
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 #4 from design-sparx/ft/default-dashboard
feat:
- Loading branch information
Showing
23 changed files
with
3,428 additions
and
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {Button, Card, CardProps, List} from "antd"; | ||
import {NotificationsItem} from "../index.ts"; | ||
import {Notifications} from "../../types"; | ||
|
||
import "./styles.css"; | ||
|
||
type Props = { | ||
data: Notifications[] | ||
} & CardProps | ||
|
||
const NotificationsCard = ({data, ...others}: Props) => { | ||
return ( | ||
<Card | ||
title="Notifications" | ||
extra={<Button>View all</Button>} | ||
className="notifications-list-card" | ||
{...others} | ||
> | ||
<List | ||
itemLayout="vertical" | ||
size="large" | ||
pagination={{ | ||
onChange: (page) => { | ||
console.log(page); | ||
}, | ||
pageSize: 5, | ||
align: "center" | ||
}} | ||
dataSource={data} | ||
renderItem={(item) => ( | ||
<List.Item key={item.notification_id}> | ||
<NotificationsItem data={item}/> | ||
</List.Item> | ||
)} | ||
/> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default NotificationsCard; |
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,7 @@ | ||
.notifications-list-card .ant-card-body { | ||
padding: 0 0 1rem 0; | ||
} | ||
|
||
.available-tucks-card .ant-list-item { | ||
/*padding: 0;*/ | ||
} |
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,53 @@ | ||
import {Notifications} from "../../types"; | ||
import {Avatar, Space, Tag, Typography} from "antd"; | ||
import {ContainerOutlined, MailOutlined, PhoneOutlined} from "@ant-design/icons"; | ||
|
||
type Props = { | ||
data: Notifications | ||
} | ||
|
||
const NotificationsItem = ({data}: Props) => { | ||
const { | ||
notification_type, | ||
notification_category, | ||
notification_image, | ||
notification_date, | ||
notification_message, | ||
color | ||
} = data | ||
|
||
return ( | ||
<div style={{display: "flex"}}> | ||
<Avatar src={notification_image}/> | ||
<div style={{display: "flex", flexDirection: "column", alignSelf: "center"}}> | ||
<div style={{display: "flex", alignItems: "center"}}> | ||
<Typography.Text | ||
strong | ||
style={{flexGrow: 1}} | ||
> | ||
{notification_message.slice(0, 30)}... | ||
</Typography.Text> | ||
<Tag | ||
bordered={true} | ||
icon={ | ||
notification_type === "voice" ? | ||
<PhoneOutlined/> : | ||
notification_type === "email" ? | ||
<MailOutlined/> : | ||
<ContainerOutlined/> | ||
} | ||
style={{textTransform: "capitalize"}} | ||
> | ||
{notification_type} | ||
</Tag> | ||
</div> | ||
<Space> | ||
<Tag bordered={true} color={color}>{notification_category}</Tag> | ||
<Typography.Text>{notification_date}</Typography.Text> | ||
</Space> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotificationsItem; |
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
12 changes: 8 additions & 4 deletions
12
src/components/dashboard/default/GetStartedCard/GetStartedCard.tsx
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
64 changes: 64 additions & 0 deletions
64
src/components/dashboard/default/TasksChartCard/TasksChartCard.tsx
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,64 @@ | ||
import {Column} from "@ant-design/plots"; | ||
import {Button, Card, CardProps} from "antd"; | ||
|
||
type Tasks = { | ||
day: string, | ||
value: number | ||
status: string | ||
} | ||
|
||
type ChartProps = { | ||
data: Tasks[] | ||
} | ||
|
||
const ColumnChart = ({data}: ChartProps) => { | ||
const config = { | ||
data, | ||
isStack: true, | ||
xField: 'day', | ||
yField: 'value', | ||
seriesField: 'status', | ||
label: { | ||
position: 'top', // 'top', 'bottom', 'middle' | ||
offset: 10, | ||
style: { | ||
fill: 'transparent' | ||
} | ||
}, | ||
interactions: [ | ||
{ | ||
type: 'active-region', | ||
enable: false, | ||
}, | ||
], | ||
columnBackground: { | ||
style: { | ||
fill: 'rgba(0,0,0,0.1)', | ||
}, | ||
}, | ||
legend: { | ||
position: "bottom" | ||
} | ||
}; | ||
|
||
// @ts-ignore | ||
return <Column {...config} />; | ||
}; | ||
|
||
type Props = { | ||
data: Tasks[] | ||
} & CardProps | ||
|
||
const TasksChartCard = ({data, ...others}: Props) => { | ||
return ( | ||
<Card | ||
title="Tasks stats" | ||
extra={<Button>See all</Button>} | ||
{...others} | ||
> | ||
<ColumnChart data={data}/> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default TasksChartCard; |
92 changes: 92 additions & 0 deletions
92
src/components/dashboard/default/TasksListCard/TasksListCard.tsx
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,92 @@ | ||
import {Badge, Button, Card, CardProps, List, Space, Tag, Typography} from "antd"; | ||
import {Tasks} from "../../../../types"; | ||
import {CalendarOutlined, FlagOutlined} from "@ant-design/icons"; | ||
import {UserAvatar} from "../../../index.ts"; | ||
|
||
import "./styles.css"; | ||
|
||
|
||
type Props = { | ||
data: Tasks[] | ||
} & CardProps | ||
|
||
const TasksListCard = ({data, ...others}: Props) => { | ||
return ( | ||
<Card | ||
title="Tasks" | ||
extra={<Button>View all</Button>} | ||
className="tasks-list-card" | ||
{...others} | ||
> | ||
<List | ||
grid={{ | ||
gutter: 16, | ||
xs: 1, | ||
sm: 1, | ||
md: 2, | ||
lg: 3, | ||
xl: 3, | ||
xxl: 4, | ||
}} | ||
pagination={{ | ||
onChange: (page) => { | ||
console.log(page); | ||
}, | ||
pageSize: 10, | ||
align: "center" | ||
}} | ||
dataSource={data} | ||
renderItem={(item) => ( | ||
<List.Item | ||
key={item.title} | ||
> | ||
<Card title={item.title}> | ||
<Space direction="vertical"> | ||
<Space style={{justifyContent: "space-between", width: "100%"}}> | ||
<Typography.Title | ||
level={5} | ||
style={{margin: 0, textTransform: "capitalize"}} | ||
> | ||
{item.name.slice(0, 20)}... | ||
</Typography.Title> | ||
<Tag bordered={false} style={{textTransform: "capitalize"}}>{item.category}</Tag> | ||
</Space> | ||
<Typography.Paragraph | ||
ellipsis={{rows: 2}} | ||
style={{marginBottom: 0}} | ||
> | ||
{item.description} | ||
</Typography.Paragraph> | ||
<Space style={{justifyContent: "space-between", width: "100%"}}> | ||
<Tag | ||
icon={<FlagOutlined/>} | ||
color={item.color} | ||
style={{textTransform: "capitalize"}} | ||
> | ||
{item.priority} | ||
</Tag> | ||
<Badge | ||
status={ | ||
item.status.toLowerCase() === "completed" | ||
? "success" | ||
: item.status.toLowerCase() === "in progress" | ||
? "processing" | ||
: "warning" | ||
} | ||
text={<span style={{textTransform: "capitalize"}}>{item.status}</span>} | ||
/> | ||
</Space> | ||
<Space style={{justifyContent: "space-between", width: "100%"}}> | ||
<Typography.Text><CalendarOutlined/>{' '}{item.due_date}</Typography.Text> | ||
<UserAvatar fullName={item.assigned_to} size="medium"/> | ||
</Space> | ||
</Space> | ||
</Card> | ||
</List.Item> | ||
)} | ||
/> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default TasksListCard; |
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,7 @@ | ||
.tasks-list-card .ant-card-body { | ||
/*padding: 0 0 1rem 0;*/ | ||
} | ||
|
||
.tasks-list-card .ant-list-item { | ||
/*padding: 0;*/ | ||
} |
42 changes: 42 additions & 0 deletions
42
src/components/dashboard/default/WeeklyActivityCard/WeeklyActivityCard.tsx
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,42 @@ | ||
import {Area} from "@ant-design/charts"; | ||
import {Card, CardProps} from "antd"; | ||
|
||
type Activity = { | ||
day: string | ||
value: number | ||
} | ||
|
||
type ChartProps = { | ||
data: Activity[] | ||
} | ||
|
||
const AreaChart = ({data}: ChartProps) => { | ||
const config = { | ||
data, | ||
xField: 'day', | ||
yField: 'value', | ||
xAxis: { | ||
range: [0, 1], | ||
}, | ||
smooth: true | ||
}; | ||
|
||
return <Area {...config} />; | ||
} | ||
|
||
type Props = { | ||
data: Activity[] | ||
} & CardProps | ||
|
||
const WeeklyActivityCard = ({data, ...others}: Props) => { | ||
return ( | ||
<Card | ||
title="Weekly activity" | ||
{...others} | ||
> | ||
<AreaChart data={data}/> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default WeeklyActivityCard; |
Oops, something went wrong.