Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"__BUG_SEVERITY_LOW": "low",
"__BUG_SEVERITY_MEDIUM": "medium",
"__CAMPAIGN_CARD_EMPTY_TITLE_LABEL": "Untitled",
"__CAMPAIGN_PAGE_BUTTON_DETAIL_BUG": "Go to Bug detail",
"__CAMPAIGN_PAGE_BUTTON_DETAIL_BUG": "Go to bug detail",
"__CAMPAIGN_PAGE_BUTTON_DETAIL_MEDIA": "Go to media detail",
"__CAMPAIGN_PAGE_INFO_HEADER_DESKTOP": "Desktop",
"__CAMPAIGN_PAGE_INFO_HEADER_FROM_DATE_TO_DATE": "<0><0>{{start_date}}</0></0> to <3><0>{{end_date}}</0></3>",
"__CAMPAIGN_PAGE_INFO_HEADER_PLATFORM_SMARTPHONE": "Smartphone",
Expand All @@ -36,6 +37,7 @@
"__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_DETAILS_UNIQUE_BUGS_LABEL": "Unique bugs distribution",
"__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OTHER_REPORTS_LABEL": "Reports & attachments",
"__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OVERVIEW_LABEL": "Campaign overview",
"__CAMPAIGN_PAGE_NAVIGATION_MEDIA_EXTERNAL_LINK_LABEL": "Media detail",
"__CAMPAIGN_PAGE_REPORTS_CARDS_DOWNLOAD_LABEL": "Download now",
"__CAMPAIGN_PAGE_REPORTS_CARDS_OPEN_LINK_LABEL": "Open link",
"__CAMPAIGN_PAGE_REPORTS_CARDS_UPDATED_ON_LABEL": "Last edit",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"__BUG_SEVERITY_MEDIUM": "medium",
"__CAMPAIGN_CARD_EMPTY_TITLE_LABEL": "Senza Titolo",
"__CAMPAIGN_PAGE_BUTTON_DETAIL_BUG": "Vai al dettaglio bug",
"__CAMPAIGN_PAGE_BUTTON_DETAIL_MEDIA": "Vai al dettaglio media",
"__CAMPAIGN_PAGE_INFO_HEADER_DESKTOP": "Desktop",
"__CAMPAIGN_PAGE_INFO_HEADER_FROM_DATE_TO_DATE": "<0><0>{{start_date}}</0></0> to <3><0>{{end_date}}</0></3>",
"__CAMPAIGN_PAGE_INFO_HEADER_PLATFORM_SMARTPHONE": "Smartphone",
Expand All @@ -38,6 +39,7 @@
"__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_DETAILS_UNIQUE_BUGS_LABEL": "Distribuzione bug unici",
"__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OTHER_REPORTS_LABEL": "Report & allegati",
"__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OVERVIEW_LABEL": "Overview campagna",
"__CAMPAIGN_PAGE_NAVIGATION_MEDIA_EXTERNAL_LINK_LABEL": "Dettaglio media",
"__CAMPAIGN_PAGE_REPORTS_CARDS_DOWNLOAD_LABEL": "Download now",
"__CAMPAIGN_PAGE_REPORTS_CARDS_OPEN_LINK_LABEL": "Open link",
"__CAMPAIGN_PAGE_REPORTS_CARDS_UPDATED_ON_LABEL": "Ultima modifica:",
Expand Down
34 changes: 18 additions & 16 deletions src/pages/Campaign/navigation/bugs/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import { Anchor } from '@appquality/unguess-design-system';
import { useTranslation } from 'react-i18next';
import { StyledDivider } from 'src/common/components/navigation';
import { getLocalizedFunctionalDashboardUrl } from 'src/hooks/useLocalizeDashboardUrl';
import i18n from 'src/i18n';
import styled from 'styled-components';

const StyledAnchor = styled(Anchor)`
display: block;
margin-bottom: ${({ theme }) => theme.space.sm};
`;

export const BugsNavigationLink = ({ campaignId }: { campaignId: number }) => {
const { t } = useTranslation();

return (
<>
<StyledDivider />
<Anchor
isExternal
onClick={() => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(
getLocalizedFunctionalDashboardUrl(campaignId, i18n.language),
'_blank'
);
}}
>
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_EXTERNAL_LINK_LABEL')}
</Anchor>
</>
<StyledAnchor
isExternal
onClick={() => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(
getLocalizedFunctionalDashboardUrl(campaignId, i18n.language),
'_blank'
);
}}
>
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_EXTERNAL_LINK_LABEL')}
</StyledAnchor>
);
};
4 changes: 3 additions & 1 deletion src/pages/Campaign/navigation/bugs/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export const BugsNavigation = () => {
>
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OVERVIEW_LABEL')}
</StickyNavItem>
<StickyNavItemLabel>
<StickyNavItemLabel style={{ display: 'none' }}>
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_GROUP_DETAILS_LABEL')}
</StickyNavItemLabel>
<StickyNavItem
style={{ display: 'none' }}
to="unique-bug-distribution"
containerId="main"
spy
Expand All @@ -33,6 +34,7 @@ export const BugsNavigation = () => {
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_DETAILS_UNIQUE_BUGS_LABEL')}
</StickyNavItem>
<StickyNavItem
style={{ display: 'none' }}
to="devices-and-types"
containerId="main"
spy
Expand Down
9 changes: 9 additions & 0 deletions src/pages/Campaign/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { useTranslation } from 'react-i18next';
import {
StickyNavItem,
StickyNavItemLabel,
StyledDivider,
} from 'src/common/components/navigation';
import { CampaignWithOutput, Report } from 'src/features/api';
import { StickyContainer } from 'src/common/components/StickyContainer';
import { BugsNavigation, BugsNavigationLink } from './bugs';
import { NavigationLoading } from './NavigationLoading';
import { MediaNavigation, MediaNavigationLink } from './media';

const Navigation = ({
campaignId,
Expand All @@ -24,6 +26,7 @@ const Navigation = ({
return (
<StickyContainer>
{outputs?.includes('bugs') && <BugsNavigation />}
{outputs?.includes('media') && <MediaNavigation />}
{reports.length || isFunctional ? (
<>
<StickyNavItemLabel>
Expand All @@ -41,9 +44,15 @@ const Navigation = ({
</StickyNavItem>
</>
) : null}
{(outputs?.includes('bugs') || outputs?.includes('media')) && (
<StyledDivider />
)}
{outputs?.includes('bugs') && (
<BugsNavigationLink campaignId={campaignId} />
)}
{outputs?.includes('media') && (
<MediaNavigationLink campaignId={campaignId} />
)}
</StickyContainer>
);
};
Expand Down
29 changes: 29 additions & 0 deletions src/pages/Campaign/navigation/media/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Anchor } from '@appquality/unguess-design-system';
import { useTranslation } from 'react-i18next';
import { getLocalizedUXDashboardUrl } from 'src/hooks/useLocalizeDashboardUrl';
import i18n from 'src/i18n';
import styled from 'styled-components';

const StyledAnchor = styled(Anchor)`
display: block;
margin-bottom: ${({ theme }) => theme.space.sm};
`;

export const MediaNavigationLink = ({ campaignId }: { campaignId: number }) => {
const { t } = useTranslation();

return (
<StyledAnchor
isExternal
onClick={() => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(
getLocalizedUXDashboardUrl(campaignId, i18n.language),
'_blank'
);
}}
>
{t('__CAMPAIGN_PAGE_NAVIGATION_MEDIA_EXTERNAL_LINK_LABEL')}
</StyledAnchor>
);
};
1 change: 1 addition & 0 deletions src/pages/Campaign/navigation/media/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const MediaNavigation = () => <div />;
4 changes: 4 additions & 0 deletions src/pages/Campaign/navigation/media/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { MediaNavigation } from './Navigation';
import { MediaNavigationLink } from './ExternalLink';

export { MediaNavigation, MediaNavigationLink };
32 changes: 29 additions & 3 deletions src/pages/Campaign/pageHeader/Pills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import { ReactComponent as IncomingIcon } from 'src/assets/icons/pill-icon-incom
import { ReactComponent as CompletedIcon } from 'src/assets/icons/pill-icon-completed.svg';
import { ReactComponent as GearIcon } from 'src/assets/icons/pill-icon-gear.svg';
import { format } from 'date-fns';
import { getLocalizedFunctionalDashboardUrl } from 'src/hooks/useLocalizeDashboardUrl';
import {
getLocalizedFunctionalDashboardUrl,
getLocalizedUXDashboardUrl,
} from 'src/hooks/useLocalizeDashboardUrl';
import i18n from 'src/i18n';

const Pipe = styled.span`
Expand All @@ -44,14 +47,19 @@ const FooterContainer = styled.div`
align-items: center;
width: 100%;
`;
const ButtonWrapper = styled.div``;
const ButtonWrapper = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
`;

const PillsWrapper = styled.div`
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
flex-direction: row;
flex-wrap: wrap;
`;

function capitalizeFirstLetter(string: string) {
Expand Down Expand Up @@ -108,6 +116,7 @@ export const Pills = ({ campaign }: { campaign: CampaignWithOutput }) => {
}

if (isLoading || isFetching) return <Skeleton width="200px" height="20px" />;

return (
<FooterContainer>
<PillsWrapper>
Expand Down Expand Up @@ -178,6 +187,23 @@ export const Pills = ({ campaign }: { campaign: CampaignWithOutput }) => {
{t('__CAMPAIGN_PAGE_BUTTON_DETAIL_BUG')}
</Button>
)}
{outputs?.includes('media') && (
<Button
isPrimary
isPill
themeColor={globalTheme.palette.water[600]}
onClick={() =>
// eslint-disable-next-line security/detect-non-literal-fs-filename
window.open(
getLocalizedUXDashboardUrl(campaign.id, i18n.language),
'_blank'
)
}
style={{ marginLeft: globalTheme.space.xs }}
>
{t('__CAMPAIGN_PAGE_BUTTON_DETAIL_MEDIA')}
</Button>
)}
</ButtonWrapper>
</FooterContainer>
);
Expand Down