Skip to content

Commit 45e4394

Browse files
authored
Cup 824 clean console (#255)
* fix(package.json): fix missing .env file in generate api scripts * fix(api): remove useless overwritten endpoint * fix(components): add missing keys in iterators * fix(search): put styled component outside the component * chore(design-system): update version
1 parent a00f888 commit 45e4394

File tree

8 files changed

+31
-44
lines changed

8 files changed

+31
-44
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.4.0",
44
"private": true,
55
"dependencies": {
6-
"@appquality/unguess-design-system": "2.12.16",
6+
"@appquality/unguess-design-system": "2.12.17",
77
"@headwayapp/react-widget": "^0.0.4",
88
"@reduxjs/toolkit": "^1.8.0",
99
"@rtk-query/codegen-openapi": "^1.0.0-alpha.1",
@@ -42,8 +42,8 @@
4242
"recover": "yarn install --check-files",
4343
"eject": "react-scripts eject",
4444
"translate": "i18next-scanner",
45-
"generate-schema": ". ./.env; npx openapi-typescript $REACT_APP_API_URL/reference/ --output src/common/schema.ts ",
46-
"generate-api": ". ./.env; API_URL=$REACT_APP_API_URL/reference/ npx @rtk-query/codegen-openapi src/features/api/config.ts",
45+
"generate-schema": ". ./.env.local; npx openapi-typescript $REACT_APP_API_URL/reference/ --output src/common/schema.ts ",
46+
"generate-api": ". ./.env.local; API_URL=$REACT_APP_API_URL/reference/ npx @rtk-query/codegen-openapi src/features/api/config.ts",
4747
"generate-strapi": "npx @rtk-query/codegen-openapi src/features/backoffice/config.ts",
4848
"type:check": "tsc",
4949
"prettier": "prettier 'src/**/*.{js,jsx,ts,tsx,json,css,scss,md}'",

src/features/api/api.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
22
import { stringify } from 'qs';
3-
import {
4-
GetWorkspacesByWidApiArg,
5-
GetWorkspacesByWidApiResponse,
6-
Template,
7-
} from '.';
3+
import { Template } from '.';
84

95
export const apiSlice = createApi({
106
reducerPath: 'api',
@@ -28,18 +24,9 @@ export const apiSlice = createApi({
2824
'Reports',
2925
'Templates',
3026
],
31-
endpoints: (build) => ({
32-
getWorkspacesByWid: build.query<
33-
GetWorkspacesByWidApiResponse,
34-
GetWorkspacesByWidApiArg
35-
>({
36-
query: (queryArg) => ({ url: `/workspaces/${queryArg.wid}` }),
37-
}),
38-
}),
27+
endpoints: () => ({}),
3928
});
4029

41-
export const { useLazyGetWorkspacesByWidQuery } = apiSlice;
42-
4330
export interface UseCaseTemplate extends Template {
4431
id?: number;
4532
}

src/pages/Dashboard/CampaignItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const CampaignItem = ({
2323
return (
2424
<CampaignCard
2525
className="suggested-campaign-card"
26-
key={campaign.id}
2726
// isNew={campaign?.isNew} TODO: need an API update
2827
date={format(new Date(campaign.start_date), 'dd/MM/Y')}
2928
projectTitle={`${project.name}`}

src/pages/Dashboard/SuggestedCampaigns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const SuggestedCampaigns = () => {
5050
<CardsContainer>
5151
<StyledRow>
5252
{campaigns.data.items.map((campaign) => (
53-
<Col xs={10} md={6} lg={3}>
53+
<Col xs={10} md={6} lg={3} key={`suggested_col_${campaign.id}`}>
5454
<CampaignItem
5555
key={`suggested_${campaign.id}`}
5656
campaign={campaign}

src/pages/Dashboard/campaigns-list/list.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,23 @@ const CardGroup = ({ items }: { items: Array<Campaign> }) => {
4040
return (
4141
<>
4242
<Col
43+
key={`campaign_project_col_${campaigns[0].project.id}`}
4344
size={12}
4445
style={{
4546
marginBottom: `${theme.space.base * 4}px`,
4647
marginTop: `${theme.space.base * 4}px`,
4748
}}
4849
>
49-
<Span isBold key={campaigns[0].project.id}>
50+
<Span isBold>
5051
{campaigns[0].project.name} ({items.length})
5152
</Span>
5253
</Col>
5354

5455
{/* <CardsContainer> */}
5556
{campaigns.map((campaign) => (
56-
<Col xs={12} md={6} lg={3}>
57+
<Col xs={12} md={6} lg={3} key={`campaign_col_${campaign.id}`}>
5758
<CampaignItem
58-
key={campaign.id}
59+
key={`campaign_${campaign.id}`}
5960
campaign={campaign}
6061
onCampaignClicked={clickToggle}
6162
style={{ marginBottom: `${theme.space.base * 4}px` }}
@@ -65,7 +66,7 @@ const CardGroup = ({ items }: { items: Array<Campaign> }) => {
6566
{/* </CardsContainer> */}
6667

6768
{items.length > 4 && (
68-
<Col size={12}>
69+
<Col size={12} key={`campaign_project_cta_${campaigns[0].project.id}`}>
6970
<FloatRight>
7071
<Button
7172
isBasic
@@ -90,8 +91,8 @@ export const CardList = ({
9091
}) => (
9192
<>
9293
{campaigns.map((group) => (
93-
<Row>
94-
<CardGroup items={group} />
94+
<Row key={`cards_row_start_${group[0].id}`}>
95+
<CardGroup key={`cards_group_start_${group[0].id}`} items={group} />
9596
</Row>
9697
))}
9798
</>

src/pages/Dashboard/filters/search.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ import { useAppDispatch, useAppSelector } from 'src/app/hooks';
77
import { searchFilterChanged } from 'src/features/campaignsFilter/campaignsFilterSlice';
88
import styled from 'styled-components';
99

10+
const StyledField = styled(Field)`
11+
width: 100%;
12+
max-width: 100% !important;
13+
14+
> * {
15+
width: 100%;
16+
}
17+
18+
@media (min-width: ${({ theme }) => theme.breakpoints.sm}) {
19+
max-width: 260px;
20+
}
21+
`;
22+
1023
export const SearchInput = () => {
1124
const { t } = useTranslation();
1225
const dispatch = useAppDispatch();
@@ -15,19 +28,6 @@ export const SearchInput = () => {
1528

1629
const [value, setValue] = useState(search || '');
1730

18-
const StyledField = styled(Field)`
19-
width: 100%;
20-
max-width: 100% !important;
21-
22-
> * {
23-
width: 100%;
24-
}
25-
26-
@media (min-width: ${({ theme }) => theme.breakpoints.sm}) {
27-
max-width: 260px;
28-
}
29-
`;
30-
3131
useEffect(() => {
3232
setValue(search || '');
3333
}, [search]);

src/pages/Dashboard/project-items/list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CardGroup = ({ items }: { items: Array<Campaign> }) => {
1414
{items.map((campaign) => (
1515
<Col size={3} xs={12} md={6} lg={3}>
1616
<CampaignItem
17-
key={campaign.id}
17+
key={`campaign_${campaign.id}`}
1818
campaign={campaign}
1919
onCampaignClicked={clickToggle}
2020
style={{ marginBottom: `${theme.space.base * 4}px` }}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
ajv-draft-04 "^1.0.0"
4343
call-me-maybe "^1.0.1"
4444

45-
"@appquality/unguess-design-system@2.12.16":
46-
version "2.12.16"
47-
resolved "https://registry.yarnpkg.com/@appquality/unguess-design-system/-/unguess-design-system-2.12.16.tgz#50d9f724650ea5a6db293cd124edf7b6f4a16e3b"
48-
integrity sha512-11OlAMEziwF5VNF5FjCuoJ1qVCyjQK9WT1NrghEBQ3Hzl+xpkYsiih65YzJ1e9RGtbJHiHPvb3OXQz/Ylke8FA==
45+
"@appquality/unguess-design-system@2.12.17":
46+
version "2.12.17"
47+
resolved "https://registry.yarnpkg.com/@appquality/unguess-design-system/-/unguess-design-system-2.12.17.tgz#d0edcd4772455df34cc716442056bd8dba3ab746"
48+
integrity sha512-n3pOfWO8lbIXywjnrmq/txE+S2h2LXRyhYM6/P+/Oihz2uodcCoQbb8WN2q39Fuog8718MDQlD2r6ndkdjZMhg==
4949
dependencies:
5050
"@tiptap/extension-bubble-menu" "^2.0.0-beta.61"
5151
"@tiptap/extension-character-count" "^2.0.0-beta.31"

0 commit comments

Comments
 (0)