Skip to content

Commit 52a4b06

Browse files
authored
Merge pull request #328 from AppQuality/develop
Release 20251006
2 parents ac57d24 + b0cad0b commit 52a4b06

File tree

54 files changed

+5209
-1168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5209
-1168
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"version": "0.2.1",
44
"private": true,
55
"dependencies": {
6-
"@appquality/appquality-design-system": "2.0.1",
6+
"@appquality/appquality-design-system": "2.0.9",
77
"@appquality/craft-blocks": "^0.1.27",
88
"@appquality/languages": "^1.4.5",
99
"@datadog/browser-logs": "^3.4.1",
10+
"@mui/material": "^7.3.2",
1011
"@reduxjs/toolkit": "^1.8.2",
1112
"@sentry/react": "^7.83.0",
1213
"date-fns": "^2.30.0",
@@ -30,6 +31,7 @@
3031
"redux-saga": "^1.1.3",
3132
"redux-thunk": "^2.3.0",
3233
"styled-components": "^6",
34+
"tippy.js": "^6.3.7",
3335
"universal-cookie": "^4.0.4",
3436
"uuid": "^8.3.2",
3537
"web-vitals": "^1.0.1",

public/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400&family=IBM+Plex+Serif:ital,wght@0,500;0,700;1,500;1,700&family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap"
7373
rel="stylesheet"
7474
/>
75+
<link
76+
rel="stylesheet"
77+
id="material-icons-css"
78+
href="//fonts.googleapis.com/icon?family=Material+Icons&amp;ver=20250519"
79+
type="text/css"
80+
media="all"
81+
/>
7582
<script src="https://polyfill.io/v3/polyfill.min.js?features=String.prototype.replaceAll%2CIntersectionObserver%2CArray.prototype.map%2CArray.prototype.reduce"></script>
7683
<script
7784
type="text/javascript"

src/Page.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { datadogLogs } from "@datadog/browser-logs";
2-
import { Location, createBrowserHistory } from "history";
2+
import { createBrowserHistory, Location } from "history";
33
import queryString from "query-string";
44
import { useEffect } from "react";
55
import { Redirect, Route, Router, Switch, useLocation } from "react-router-dom";
@@ -24,6 +24,8 @@ import {
2424
Wallet,
2525
} from "./pages";
2626
import BugForm from "./pages/BugForm";
27+
import Manual from "./pages/Manual";
28+
import Preview from "./pages/Preview";
2729
import SignupSuccess from "./pages/SignupSuccess";
2830
import ThankYouPage from "./pages/ThankYou";
2931
import VdpPage from "./pages/VDP";
@@ -192,6 +194,14 @@ function Page() {
192194
path={`${base}/campaign/:id/preview-selection-form`}
193195
component={PreviewSelectionForm}
194196
/>
197+
<SentryRoute
198+
path={`${base}/campaigns/:id/preview`}
199+
component={Preview}
200+
/>
201+
<SentryRoute
202+
path={`${base}/campaigns/:id/manual`}
203+
component={Manual}
204+
/>
195205
<SentryRoute
196206
path={["/goodbye", "/it/goodbye", "/es/goodbye", "/fr/goodbye"]}
197207
exact

src/locales/en/translation.json

Lines changed: 77 additions & 1 deletion
Large diffs are not rendered by default.

src/locales/es/translation.json

Lines changed: 78 additions & 2 deletions
Large diffs are not rendered by default.

src/locales/fr/translation.json

Lines changed: 78 additions & 1 deletion
Large diffs are not rendered by default.

src/locales/it/translation.json

Lines changed: 78 additions & 2 deletions
Large diffs are not rendered by default.

src/pages/BugForm/FileUploader/FileCard/style.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export const StyledFileCard = styled.div`
104104
}
105105
}
106106
.file-card-right {
107-
width: 15%;
108107
svg {
109108
width: 18px;
110109
height: 18px;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Button, Text, Title } from "@appquality/appquality-design-system";
2+
import { useTranslation } from "react-i18next";
3+
import WPAPI from "src/utils/wpapi";
4+
import { styled } from "styled-components";
5+
6+
const Wrapper = styled.div`
7+
display: flex;
8+
flex-direction: column;
9+
align-items: center;
10+
justify-content: center;
11+
text-align: center;
12+
gap: 0.5rem;
13+
padding: 2rem;
14+
`;
15+
16+
const AcceptContract = ({ id }: { id: string }) => {
17+
const { t } = useTranslation();
18+
return (
19+
<Wrapper>
20+
<Title size="xl">{t("__MANUAL_ACCEPT_CONTRACT_TITLE")}</Title>
21+
<Title>{t("__MANUAL_ACCEPT_CONTRACT_SUBTITLE")}</Title>
22+
<Button
23+
flat
24+
kind="secondary"
25+
onClick={async () => {
26+
await WPAPI.startCampaign(id);
27+
window.location.reload();
28+
}}
29+
>
30+
Clicca per iniziare
31+
</Button>
32+
<Text>
33+
Cliccando su questo pulsante accetti il contratto ed i nostri attuali
34+
Termini & Condizioni
35+
</Text>
36+
</Wrapper>
37+
);
38+
};
39+
40+
export default AcceptContract;

src/pages/Manual/BugCard/index.tsx

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
import { Card, Text } from "@appquality/appquality-design-system";
2+
import { useTranslation } from "react-i18next";
3+
import { Link } from "react-router-dom";
4+
import { useLocalizeRoute } from "src/hooks/useLocalizedRoute";
5+
import {
6+
useGetUsersMeBugsQuery,
7+
useGetUsersMeCampaignsByCampaignIdQuery,
8+
} from "src/services/tryberApi";
9+
import { styled, useTheme } from "styled-components";
10+
11+
const Wrapper = styled.div`
12+
display: grid;
13+
grid-template-columns: 1fr 1fr;
14+
gap: 1rem;
15+
16+
.bug_container {
17+
display: flex;
18+
flex-direction: column;
19+
align-items: center;
20+
21+
.type {
22+
font-size: 0.75rem;
23+
}
24+
}
25+
`;
26+
27+
const useFilteredBugsUrl = () => {
28+
const baseUrl = useLocalizeRoute("my-bugs");
29+
30+
return (campaignId: string, status: string) => {
31+
const url = new URL(baseUrl, window.location.origin);
32+
url.searchParams.set("cp", campaignId);
33+
url.searchParams.set("status", status);
34+
return url.pathname + url.search;
35+
};
36+
};
37+
38+
const LinkToBugList = ({
39+
count,
40+
campaignId,
41+
statusId,
42+
children,
43+
}: {
44+
count: number;
45+
campaignId: string;
46+
statusId: string;
47+
children: React.ReactNode;
48+
}) => {
49+
const getBugUrl = useFilteredBugsUrl();
50+
51+
if (count === 0) {
52+
return <>{children}</>;
53+
}
54+
55+
return (
56+
<Link
57+
style={{ textDecoration: "none" }}
58+
to={getBugUrl(campaignId, statusId)}
59+
>
60+
{children}
61+
</Link>
62+
);
63+
};
64+
65+
const useGetBugsCountByStatus = ({ id }: { id: string }) => {
66+
const { data: bugs } = useGetUsersMeBugsQuery(
67+
{ filterBy: { campaign: id } },
68+
{ skip: !id }
69+
);
70+
71+
if (!bugs) {
72+
return {
73+
approved: 0,
74+
refused: 0,
75+
needReview: 0,
76+
pending: 0,
77+
};
78+
}
79+
80+
return {
81+
approved: bugs.results.filter((bug) => bug.status?.id === 2).length,
82+
refused: bugs.results.filter((bug) => bug.status?.id === 1).length,
83+
needReview: bugs.results.filter((bug) => bug.status?.id === 4).length,
84+
pending: bugs.results.filter((bug) => bug.status?.id === 3).length,
85+
};
86+
};
87+
88+
const BugCard = ({ id }: { id: string }) => {
89+
const { t } = useTranslation();
90+
const theme = useTheme();
91+
const { data: campaign } = useGetUsersMeCampaignsByCampaignIdQuery({
92+
campaignId: id,
93+
});
94+
const { approved, refused, needReview, pending } = useGetBugsCountByStatus({
95+
id,
96+
});
97+
98+
if (!campaign || !campaign.hasBugForm) {
99+
return null;
100+
}
101+
102+
return (
103+
<Card
104+
title={t("__MANUAL_BUG_CARD_TITLE", "Bugs found")}
105+
className="aq-mb-4"
106+
>
107+
<Wrapper>
108+
<LinkToBugList campaignId={id} statusId="2" count={approved}>
109+
<Text
110+
style={{ color: theme.palette.success }}
111+
className="bug_container"
112+
>
113+
<b>{approved}</b>
114+
<span className="type">
115+
{t("__MANUAL_BUG_CARD_APPROVED", "APPROVED")}
116+
</span>
117+
</Text>
118+
</LinkToBugList>
119+
<LinkToBugList campaignId={id} statusId="1" count={refused}>
120+
<Text
121+
style={{ color: theme.palette.danger }}
122+
className="bug_container"
123+
>
124+
<b>{refused}</b>
125+
<span className="type">
126+
{t("__MANUAL_BUG_CARD_REFUSED", "REFUSED")}
127+
</span>
128+
</Text>
129+
</LinkToBugList>
130+
<LinkToBugList campaignId={id} statusId="4" count={needReview}>
131+
<Text
132+
className="bug_container"
133+
style={{ color: theme.palette.warning }}
134+
>
135+
<b>{needReview}</b>
136+
<span className="type">
137+
{t("__MANUAL_BUG_CARD_NEED_REVIEW", "NEED REVIEW")}
138+
</span>
139+
</Text>
140+
</LinkToBugList>
141+
<LinkToBugList campaignId={id} statusId="3" count={pending}>
142+
<Text className="bug_container" style={{ color: theme.palette.info }}>
143+
<b>{pending}</b>
144+
<span className="type">
145+
{t("__MANUAL_BUG_CARD_PENDING", "PENDING")}
146+
</span>
147+
</Text>
148+
</LinkToBugList>
149+
</Wrapper>
150+
</Card>
151+
);
152+
};
153+
154+
export { BugCard };

0 commit comments

Comments
 (0)