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

[TBCCT-133] Added Project details Drawer #109

Merged
merged 7 commits into from
Nov 26, 2024

Conversation

onehanddev
Copy link
Contributor

@onehanddev onehanddev commented Nov 19, 2024

Added Project details drawer / sheet for project list and its dependent components.

Thing remaining -

  • Fetch data from API and load it dynamically based on each project.
  • Show the Project Details drawer for the other views like Scorecard Prioritization and key costs etc.
  • Add required views/actions for Compare with a different project and Add button
  • Add functionality to switch between previous and next projects from the chevron up/down button from the details title section (its better to do this once we have the dynamic data).
  • Filter functionality from details panel.
image image
Screen.Recording.2024-11-19.at.5.41.37.PM.mov

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tnc-blue-carbon-cost-tool-ghps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 10:40am

@onehanddev onehanddev requested a review from agnlez November 19, 2024 12:12
Comment on lines 73 to 80
const [filters, setFilters] = useGlobalFilters();

const handleParameters = async (
v: string,
parameter: keyof Omit<z.infer<typeof filtersSchema>, "keyword">,
) => {
await setFilters((prev) => ({ ...prev, [parameter]: v }));
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filters hosted in this detail DO NOT affect to the global ones in the overview page, they need to be independent and only affect to the content of the detail once connected to the API.

Comment on lines 113 to 114
open={openDetails}
setIsOpen={setOpenDetails}
Copy link
Member

@agnlez agnlez Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing props, I would suggesting using a jotai atom here so the state is easily accessible from anywhere and we avoid increasing the properties of the component.

@agnlez
Copy link
Member

agnlez commented Nov 20, 2024

image

image

Color of text should be different (I think it's text-muted-foreground for the first case)

@agnlez
Copy link
Member

agnlez commented Nov 20, 2024

image

Abatement potential is measured in tCO2e/yr

@agnlez
Copy link
Member

agnlez commented Nov 20, 2024

image
Can you add some padding to the right side so the title of the dialog doesn't collide with the close button when the title is long?

@agnlez
Copy link
Member

agnlez commented Nov 20, 2024

image

Please, remove the bottom border for the last row.

@agnlez
Copy link
Member

agnlez commented Nov 20, 2024

image
I don't think this is actually a button (only the + one)

Comment on lines 165 to 167
<h3 className="text-md font-medium">Total project cost</h3>
<InfoButton title="Refers to the summary of Capital Expenditure and Operating Expenditure" />
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's aLabel component with a tooltip property where you can achieve the same result, please use it.

Comment on lines 21 to 23
const formatAmount = (value: number) => {
return `${(value / 1_000_000).toFixed(1)}M`;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't format anything in the component: we don't know if we will have always millions or not. I would move the format function out of the component and format the segment in the place of the implementation and pass it to the this component formatted.

orientation?: "horizontal" | "vertical";
}

const BarChart = ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this component to be agnostic and reusable in other pages, so, please, move it to the components folder.

SheetTitle,
} from "@/components/ui/sheet";

const Currency = ({ value }: { value: number }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a renderCurrency method to achieve this in @/lib/format.

* @example
* parseCurrency(1234.56) // returns ['$', '1,234']
*/
export const parseCurrency = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we can replace this with renderCurrency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that works perfectly 👍

@agnlez agnlez changed the title feature: Added Project details Drawer [TBCCT-133] Added Project details Drawer Nov 20, 2024
@onehanddev
Copy link
Contributor Author

image Can you add some padding to the right side so the title of the dialog doesn't collide with the close button when the title is long?

Thats no longer needed once we replaced the InfoButton with Label component.

@onehanddev
Copy link
Contributor Author

Thats no longer needed once we replaced the InfoButton with Label component.

Thats no longer needed once we replaced the InfoButton with Label component.

Comment on lines 86 to 92
function useFilters() {
return useQueryState(
"filters",
parseAsJson(filtersSchema.parse).withDefault(INITIAL_FILTERS_STATE),
);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the filters for detail really simple and not share them in the URL: this might be confusing for the user as we already sharing the filters of the overview page. Use a jotai's atom to handle them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there will be only 3 filters: project size, carbon pricing type and cost, so we can remove the rest of them for the detail.

@onehanddev
Copy link
Contributor Author

@onehanddev we are missing the fixed footer in the panel image

You can find it here: https://www.figma.com/proto/ZzvgiambS60zL5oVbMgcyF/%5BWIP%5D---Blue-Carbon-tool-Visuals?node-id=5167-38035&node-type=frame&t=rGq7B8Ioh4BZk2fp-0&scaling=min-zoom&content-scaling=fixed&page-id=1166%3A4310&starting-point-node-id=5176%3A45482

Oh maybe I was referring to some old design, should I go ahead and add the modal popup which comes when we click on 'Create Custom Project' button ?

@agnlez
Copy link
Member

agnlez commented Nov 21, 2024

@onehanddev we are missing the fixed footer in the panel image
You can find it here: https://www.figma.com/proto/ZzvgiambS60zL5oVbMgcyF/%5BWIP%5D---Blue-Carbon-tool-Visuals?node-id=5167-38035&node-type=frame&t=rGq7B8Ioh4BZk2fp-0&scaling=min-zoom&content-scaling=fixed&page-id=1166%3A4310&starting-point-node-id=5176%3A45482

Oh maybe I was referring to some old design, should I go ahead and add the modal popup which comes when we click on 'Create Custom Project' button ?

Yes, please. And the "create" button inside the popup should take the user to /projects/new, which is a work-in-progress page right now.

@onehanddev
Copy link
Contributor Author

@onehanddev we are missing the fixed footer in the panel image

You can find it here: https://www.figma.com/proto/ZzvgiambS60zL5oVbMgcyF/%5BWIP%5D---Blue-Carbon-tool-Visuals?node-id=5167-38035&node-type=frame&t=rGq7B8Ioh4BZk2fp-0&scaling=min-zoom&content-scaling=fixed&page-id=1166%3A4310&starting-point-node-id=5176%3A45482

Oh maybe I was referring to some old design, should I go ahead and add the modal popup which comes when we click on 'Create Custom Project' button ?

Yes, please. And the "create" button inside the popup should take the user to /projects/new, which is a work-in-progress page right now.

Just made this change, please check and let me know if there is a room for enhancement.

@agnlez
Copy link
Member

agnlez commented Nov 25, 2024

image
The styles here look a bit weird:

  • the "create custom project" button aligns further the padding of the drawer.
  • there are like borders in the bottom corners of the last item of the table, "total cost".
  • I would use position: sticky for the footer instead of magic numbers to calculate the width.

Comment on lines 25 to 36
const INITIAL_FILTERS_STATE: z.infer<typeof filtersSchema> = {
keyword: "",
projectSizeFilter: PROJECT_SIZE_FILTER.MEDIUM,
priceType: PROJECT_PRICE_TYPE.OPEN_BREAK_EVEN_PRICE,
costRangeSelector: COST_TYPE_SELECTOR.NPV,
countryCode: "",
ecosystem: [],
activity: [],
activitySubtype: [],
costRange: INITIAL_COST_RANGE,
abatementPotentialRange: INITIAL_ABATEMENT_POTENTIAL_RANGE,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using only 3 properties here: projectSizeFilter, priceType and costRange. Remove the rest of them.

@agnlez
Copy link
Member

agnlez commented Nov 26, 2024

@onehanddev the cost selector appears empty by default. After fixing that, feel free to merge.

image

@onehanddev onehanddev merged commit de5b2d8 into dev Nov 26, 2024
3 checks passed
@onehanddev onehanddev deleted the feature/TBCCT-133-implement-details-right-side-panel branch November 26, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants