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

feat(web): link data portal from app #7703

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions web/src/components/buttons/DownloadCsv.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Button } from 'components/Button';
import { Download } from 'lucide-react';
import { memo } from 'react';
import { useParams } from 'react-router-dom';
import { DEFAULT_ICON_SIZE } from 'utils/constants';

function DownloadCsv() {
const { zoneId } = useParams();

const url = `https://portal.electricitymaps.com/datasets/${zoneId}?utm_source=app&utm_medium=download_button&utm_campaign=csv_download`;

return (
<Button
href={url}
icon={<Download size={DEFAULT_ICON_SIZE} />}
type="tertiary"
size="md"
aria-label="Download CSV Data"
/>
Comment on lines +13 to +19
Copy link
Member

Choose a reason for hiding this comment

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

Can we mark that this is an external link just like we do in the header the desktop view?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In line with trying to unify the journey I think this should feel as "one platform" as possible, I feel the external link will feel disconnected from the unified experience

Copy link
Member

Choose a reason for hiding this comment

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

I get that but this will also be available on mobile which could lead to unexpected navigations.

I don't think that should be a blocker though.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like the new portal does the same thing: image

);
}

export default memo(DownloadCsv);
2 changes: 2 additions & 0 deletions web/src/features/panels/zone/ZoneHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DownloadCsv from 'components/buttons/DownloadCsv';
import { MoreOptionsDropdown, useShowMoreOptions } from 'components/MoreOptionsDropdown';
import { TimeDisplay } from 'components/TimeDisplay';
import { useFeatureFlag } from 'features/feature-flags/api';
Expand Down Expand Up @@ -45,6 +46,7 @@ export default function ZoneHeader({ zoneId, isEstimated }: ZoneHeaderTitleProps
<ZoneHeaderTitle zoneId={zoneId} zoneNameFull={zoneNameFull} />
<TimeDisplay className="whitespace-nowrap text-sm" />
</div>
<DownloadCsv />
{isShareButtonEnabled &&
isConsumption &&
(showMoreOptions ? (
Expand Down