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

Change "see issue #5613" to "see details" #6657

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions web/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
},
"estimation-card": {
"link": "Read about our estimation models",
"outage-details": "See details",
"estimated_time_slicer_average": {
"title": "Data is currently estimated",
"pill": "Unavailable",
Expand Down
47 changes: 47 additions & 0 deletions web/src/features/panels/zone/EstimationCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { Meta, StoryObj } from '@storybook/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { I18nextProvider } from 'react-i18next';
import i18n from 'translation/i18n';

import EstimationCard from './EstimationCard';

const meta: Meta<typeof EstimationCard> = {
title: 'EstimationCard',
component: EstimationCard,
};

export default meta;
type Story = StoryObj<typeof EstimationCard>;
const instance: { message: string; issue: string } = {
message: 'Some outage message.',
issue: '5613',
};
const queryClient = new QueryClient();

export const All: Story = {
render: () => (
<div className="space-y-2">
<I18nextProvider i18n={i18n}>
<QueryClientProvider client={queryClient}>
<EstimationCard cardType="outage" outageMessage={instance} />

<EstimationCard cardType="estimated" outageMessage={instance} />

<EstimationCard
cardType="estimated"
outageMessage={instance}
estimationMethod="estimated_mode_breakdown"
/>

<EstimationCard
cardType="aggregated"
outageMessage={instance}
estimatedPercentage={20}
/>

<EstimationCard cardType="aggregated" outageMessage={instance} />
</QueryClientProvider>
</I18nextProvider>
</div>
),
};
4 changes: 2 additions & 2 deletions web/src/features/panels/zone/EstimationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,17 @@ function OutageMessage({
if (!outageData || !outageData.message) {
return null;
}
const { t } = useTranslation();
return (
<span className="inline overflow-hidden">
{truncateString(outageData.message, 300)}{' '}
{outageData?.issue && outageData.issue != 'None' && (
<span className="mt-1 inline-flex">
See{' '}
<a
className="inline-flex text-sm font-semibold text-black underline dark:text-white"
href={`https://github.com/electricitymaps/electricitymaps-contrib/issues/${outageData.issue}`}
>
<span className="pl-1 underline">issue #{outageData.issue}</span>
<span className="pl-1 underline">{t('estimation-card.outage-details')}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Nice to get the whole string translatable as well!

<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
Expand Down