Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/opening design review #325

Merged
merged 24 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
db04720
fixed padding and color around the cards, and tabs
jazzgrewal May 23, 2024
c14317a
changed the icon to location
jazzgrewal May 23, 2024
df1dbb0
made the changes to icon, table colors, table data, descripons and more
jazzgrewal May 24, 2024
34a2a44
added margin underneath map
jazzgrewal May 28, 2024
2222673
changed the Opening Submission trends
jazzgrewal May 30, 2024
447359d
Merge branch 'main' of github.com:bcgov/nr-silva into fix/openingDesi…
jazzgrewal Jun 4, 2024
f540a8d
Merge branch 'main' of github.com:bcgov/nr-silva into fix/openingDesi…
jazzgrewal Jun 4, 2024
faf9347
Changed the icon to location
jazzgrewal Jun 4, 2024
a507e86
fixed the styling for the BarChartGrouped
jazzgrewal Jun 4, 2024
d985d28
removed the OpeningService.js causing issue
jazzgrewal Jun 4, 2024
6602788
fixed the BarChartGrouped
jazzgrewal Jun 5, 2024
43a5e48
fixed the DonutChart component's styling and feature
jazzgrewal Jun 5, 2024
12a9a5b
fixed the DonutChart label
jazzgrewal Jun 5, 2024
b795445
added the favoritButton functionality
jazzgrewal Jun 7, 2024
844a1d4
fixed the styling for the My recent actions
jazzgrewal Jun 7, 2024
0b41051
Merge branch 'main' into fix/openingDesignReview
jazzgrewal Jun 7, 2024
8640e01
fixed spacing according to Ricardo's comments
jazzgrewal Jun 11, 2024
1463ed6
made some more visual changes
jazzgrewal Jun 19, 2024
eda11f3
added the subitle in the metrics tab
jazzgrewal Jun 20, 2024
39a9d09
Merge branch 'main' into fix/openingDesignReview
Jun 24, 2024
eeed3a0
fixed the action table
jazzgrewal Jun 26, 2024
6b43155
Merge partially branch 'main' of github.com:bcgov/nr-silva into fix/o…
jazzgrewal Jun 26, 2024
13fccd4
fixed build error
jazzgrewal Jun 26, 2024
4ceab66
test: fix test cases
Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 36 additions & 32 deletions frontend/src/components/ActionsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,67 @@ interface IActionsTable {

const ActionsTable: React.FC<IActionsTable> = ({ rows, headers }) => {
const getTypeEnum = (typeStr: string): ActivityTagTypeEnum => {
if (typeStr === ActivityTagTypeEnum.OPENING_DETAILS) {
return ActivityTagTypeEnum.OPENING_DETAILS;
} else if (typeStr === ActivityTagTypeEnum.OPENING_REPORT) {
return ActivityTagTypeEnum.OPENING_REPORT;
} else if (typeStr === ActivityTagTypeEnum.OPENING_SPATIAL) {
return ActivityTagTypeEnum.OPENING_SPATIAL;
} else if (typeStr === ActivityTagTypeEnum.UPDATE) {
return ActivityTagTypeEnum.UPDATE;
} else {
return ActivityTagTypeEnum.UNKNOWN;
switch (typeStr) {
case ActivityTagTypeEnum.OPENING_DETAILS:
return ActivityTagTypeEnum.OPENING_DETAILS;
case ActivityTagTypeEnum.OPENING_REPORT:
return ActivityTagTypeEnum.OPENING_REPORT;
case ActivityTagTypeEnum.OPENING_SPATIAL:
return ActivityTagTypeEnum.OPENING_SPATIAL;
case ActivityTagTypeEnum.UPDATE:
return ActivityTagTypeEnum.UPDATE;
default:
return ActivityTagTypeEnum.UNKNOWN;
}
};

const getFileFormatEnum = (formatStr: string): ActivityTagFileFormatEnum => {
if (formatStr === ActivityTagFileFormatEnum.PDF_FILE) {
return ActivityTagFileFormatEnum.PDF_FILE;
} else if (formatStr === ActivityTagFileFormatEnum.CSV_FILE) {
return ActivityTagFileFormatEnum.CSV_FILE;
} else if (formatStr === ActivityTagFileFormatEnum.EXCEL_FILE) {
return ActivityTagFileFormatEnum.EXCEL_FILE;
} else {
return ActivityTagFileFormatEnum.UNKNOWN;
switch (formatStr) {
case ActivityTagFileFormatEnum.PDF_FILE:
return ActivityTagFileFormatEnum.PDF_FILE;
case ActivityTagFileFormatEnum.CSV_FILE:
return ActivityTagFileFormatEnum.CSV_FILE;
case ActivityTagFileFormatEnum.EXCEL_FILE:
return ActivityTagFileFormatEnum.EXCEL_FILE;
default:
return ActivityTagFileFormatEnum.UNKNOWN;
}
};

const headerKeys = headers.map(header => header.key);

return (
<Table size="lg" useZebraStyles={false} aria-label="actions table">
<TableHead>
<TableRow>
{headers.map(header => <TableHeader id={header.key} key={header.key}>
{headers.map(header => (
<TableHeader id={header.key} key={header.key}>
{header.header}
</TableHeader>)}
</TableHeader>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row: RecentAction, idx: number) =>
{rows.map((row: RecentAction, idx: number) => (
<TableRow key={idx}>
{ Object.keys(row).filter((rowKey: string) => rowKey !== 'id').map((key: string) => {
return (
{headerKeys.map((key: string) => (
<TableCell key={key}>
{key === "statusCode" ? (
<StatusTag code={row[key]} />
):
key === "activityType" && !row["fileFormat"] ? (
) : key === "activityType" && !row["fileFormat"] ? (
<ActivityTag type={getTypeEnum(row[key])} />
):
key === "activityType" && row["fileFormat"] ? (
) : key === "activityType" && row["fileFormat"] ? (
<ActivityTag
type={getTypeEnum(row[key])}
fileFormat={getFileFormatEnum(row["fileFormat"])}
/>
):
row[key]}
) : (
row[key]
)}
</TableCell>
);
})}
</TableRow>)}
))}
</TableRow>
))}
</TableBody>
</Table>
);
Expand Down
22 changes: 0 additions & 22 deletions frontend/src/components/ActionsTable/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@
}
}

.#{vars.$bcgov-prefix}--data-table thead tr th#blank {
min-width:50px;
}

.#{vars.$bcgov-prefix}--data-table thead tr th {
background-color: #F3F3F5;
border-top: 1px solid #DFDFE1;
}

.#{vars.$bcgov-prefix}--data-table thead tr th {
min-width:158px;
}

.#{vars.$bcgov-prefix}--data-table tr td {
background-color: white;
color:black;
height: 64px;
}
.#{vars.$bcgov-prefix}--data-table tr:hover td {
background-color: #F3F3F5;
}

@media only screen and (max-width: 672px) {
.#{vars.$bcgov-prefix}--data-table-content {
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/BCHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const BCHeader: React.FC = () => {
<HeaderContainer
render={({ isSideNavExpanded, onClickSideNavExpand }: HeaderContainerProps) => (
<Header aria-label="React TS Carbon QuickStart"
className="spar-header"
data-testid="bc-header__header">
className="spar-header"
data-testid="header">
<SkipToContent />
<HeaderMenuButton
aria-label={isSideNavExpanded ? 'Close menu' : 'Open menu'}
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/BCHeaderwSide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ const listItems: ListItems[] = [
disabled: false,
subItems: [
{
name: 'Silviculture search',
name: 'Home page',
link: '/opening',
disabled: false
},
{
name: 'Silviculture search',
link: '/opening/silviculture',
disabled: false
},
{
name: 'Create an opening',
link: '/opening/create',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@
}
.cds--cc--grid rect.chart-grid-backdrop {
fill: var(--#{vars.$bcgov-prefix}-layer-02);
}
.#{vars.$bcgov-prefix}--date-picker-container {
min-height: 66px;
}
.bar-chart-container {
padding-bottom: 16px;
}
89 changes: 48 additions & 41 deletions frontend/src/components/BarChartGrouped/index.tsx
jazzgrewal marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { fetchOpeningsPerYear } from "../../services/OpeningService";
import { OpeningPerYearChart } from "../../types/OpeningPerYearChart";

interface IDropdownItem {
value: string,
text: string
value: string;
text: string;
}

const BarChartGrouped = () => {
Expand All @@ -30,7 +30,7 @@ const BarChartGrouped = () => {
setIsLoading(true);
let formattedStartDate: string | null = null;
let formattedEndDate: string | null = null;

if (startDate) {
formattedStartDate = formatDateToString(startDate);
}
Expand All @@ -42,7 +42,7 @@ const BarChartGrouped = () => {
orgUnitCode,
statusCode,
entryDateStart: formattedStartDate,
entryDateEnd: formattedEndDate
entryDateEnd: formattedEndDate,
});
setChartData(data);
setIsLoading(false);
Expand All @@ -56,8 +56,8 @@ const BarChartGrouped = () => {
window.addEventListener("resize", handleResize);
return () => window.removeEventListener("resize", handleResize);
}, [orgUnitCode, statusCode, startDate, endDate]);
const formatDateToString = (dateToFormat: Date | null) => {

const formatDateToString = (dateToFormat: Date) => {
if (!dateToFormat) return null;
const year = dateToFormat.getFullYear();
const month = String(dateToFormat.getMonth() + 1).padStart(2, "0");
Expand All @@ -66,7 +66,7 @@ const BarChartGrouped = () => {
};

const colors = {
"Openings": "#1192E8",
Openings: "#1192E8",
};

const options = {
Expand All @@ -86,93 +86,101 @@ const BarChartGrouped = () => {
grid: {
x: {
enabled: false,
color: '#d3d3d3',
strokeDashArray: '2,2'
color: "#d3d3d3",
strokeDashArray: "2,2",
},
y: {
enabled: true,
color: '#d3d3d3',
strokeDashArray: '2,2'
}
color: "#d3d3d3",
strokeDashArray: "2,2",
},
},
toolbar: {
enabled: false,
numberOfIcons: 2,
controls: [
{
type: "Make fullscreen"
type: "Make fullscreen",
},
{
type: "Make fullscreen"
type: "Make fullscreen",
},
]
}
],
},
};

const orgUnitItems = [
{ value: 'DCR', text: 'DCR' },
{ value: 'XYZ', text: 'District 2' },
{ value: "DCR", text: "DCR" },
{ value: "XYZ", text: "District 2" },
// Add more options as needed
];

const statusItems = [
{ value: 'APP', text: 'Approved' },
{ value: 'NAN', text: 'Not Approved' },
{ value: "APP", text: "Approved" },
{ value: "NAN", text: "Not Approved" },
// Add more options as needed
];

const setOrgUnitCodeSelected = ({selectedItem}:{selectedItem: IDropdownItem}) => {
const setOrgUnitCodeSelected = ({
selectedItem,
}: {
selectedItem: IDropdownItem;
}) => {
setOrgUnitCode(selectedItem.value);
};

const setStatusCodeSelected = ({selectedItem}:{selectedItem: IDropdownItem}) => {
const setStatusCodeSelected = ({
selectedItem,
}: {
selectedItem: IDropdownItem;
}) => {
setStatusCode(selectedItem.value);
};

return (
<div className="px-3">
<div className="row gy-2 pb-3">
<div className="col-md-4 p-0">
<div className="row gy-2 gx-1 pb-3">
<div className="col-md-3">
<Dropdown
id="district-dropdown"
label={windowWidth <= 1584 ? "District" : "Filter by district"}
titleText={windowWidth <= 1584 ? "District" : "Filter by district"}
titleText="District"
items={orgUnitItems}
itemToString={(item: IDropdownItem) => item ? item.text : ''}
itemToString={(item: IDropdownItem) => (item ? item.text : "")}
onChange={setOrgUnitCodeSelected}
label="District"
/>
</div>
<div className="col-md-4 p-0 px-md-1">
<div className="col-md-3">
<Dropdown
id="status-dropdown"
label={windowWidth <= 1584 ? "Status" : "Filter by status"}
titleText={windowWidth <= 1584 ? "Status" : "Filter by status"}
titleText="Status"
items={statusItems}
itemToString={(item: IDropdownItem) => item ? item.text : ''}
itemToString={(item: IDropdownItem) => (item ? item.text : "")}
onChange={setStatusCodeSelected}
label="Status"
/>
</div>
<div className="col-2 px-md-1 d-none d-md-block">
<div className="col-md-2 col-xxl-3 d-none d-md-block">
<DatePicker
datePickerType="single"
onChange={(date: Date) => setStartDate(date)}
onChange={(dates: [Date]) => setStartDate(dates[0])}
>
<DatePickerInput
id="start-date-picker-input-id"
placeholder="yyyy-MM-dd"
placeholder="yyyy/MM/dd"
size="md"
labelText="Start Date"
/>
</DatePicker>
</div>
<div className="col-2 px-md-1 d-none d-md-block">
<div className="col-md-2 col-xxl-3 d-none d-md-block">
<DatePicker
datePickerType="single"
onChange={(date: Date) => setEndDate(date)}
onChange={(dates: [Date]) => setEndDate(dates[0])}
>
<DatePickerInput
id="end-date-picker-input-id"
placeholder="yyyy-MM-dd"
placeholder="yyyy/MM/dd"
size="md"
labelText="End Date"
/>
Expand All @@ -182,10 +190,9 @@ const BarChartGrouped = () => {
{isLoading ? (
<p>Loading...</p>
) : (
<GroupedBarChart
data={chartData}
options={options}
/>
<div className="bar-chart-container">
<GroupedBarChart data={chartData} options={options} />
</div>
)}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ChartContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function ChartContainer({ children, title, description }: Props)
/>
<Button
hasIconOnly
iconDescription="Overflow menu vertical"
iconDescription="Download options"
tooltipposition="bottom"
kind="ghost"
onClick={() => console.log('Download Click')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@

text.pie-label {
font-weight: 700;
}
.mt10 {
margin-top: 10px !important;
}
.donut-chart-container {
padding-top: 32px;
padding-bottom: 16px;
}
Loading
Loading