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

#124 improve UI with new fields #190

Merged
merged 41 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
02e9855
See #168 : improve documentation
guillermau Nov 12, 2024
cf653ad
Fix #168 : a small mistake
guillermau Nov 12, 2024
85fd566
see #160 : remove the not null on addedByAgentId
guillermau Nov 12, 2024
58f219c
see #160 : featch all data from HAL
guillermau Nov 12, 2024
6692c03
see #160 : filter by software which have swhidId and handle parse error
guillermau Nov 13, 2024
f5e4246
See #166 : import more data into DB
guillermau Nov 18, 2024
c30250a
Merge remote-tracking branch 'origin/main' into #160-automated-import
guillermau Nov 18, 2024
2b332f8
see #160 : revert agentId allowed to null
guillermau Nov 18, 2024
4e6df3f
see #160 : add agent id init or get
guillermau Nov 18, 2024
9eecfb5
se #160 : improve request on db
guillermau Nov 18, 2024
9c9800c
see #160 : improve style
guillermau Nov 18, 2024
6ea7bfa
Improve dev env
guillermau Nov 18, 2024
8919db8
Merge remote-tracking branch 'origin/main' into #166-importe-more-dat…
guillermau Nov 18, 2024
15fec3f
see #160 : revert agentId allowed to null
guillermau Nov 18, 2024
a0d5ba1
see #160 : add agent id init or get
guillermau Nov 18, 2024
9865eb0
se #160 : improve request on db
guillermau Nov 18, 2024
1fdb4c1
see #160 : improve style
guillermau Nov 18, 2024
7b15706
see #166 : retrieve and map data
guillermau Nov 18, 2024
f19a92b
see #166 : fix tests
guillermau Nov 19, 2024
f950085
see #166 : fix tests
guillermau Nov 19, 2024
f43f26d
see #166 : Import as array
guillermau Nov 19, 2024
9c96231
#166 : load new env conf in sh
guillermau Nov 20, 2024
833d4b2
#160 : fix syle
guillermau Nov 20, 2024
bf3b7c8
#160 : change the way to load config
guillermau Nov 20, 2024
6f1aa10
Merge branch '#160-automated-import' into #166-importe-more-data-from…
guillermau Nov 20, 2024
33eaf7e
#166 Fix test
guillermau Nov 20, 2024
2218a22
#166 : present date of the version
guillermau Nov 20, 2024
30d285b
see #166 : fix date from wikidata and tests
guillermau Nov 21, 2024
e7b02fa
see #124 : fix catalog view
guillermau Nov 21, 2024
39bd410
see #124 : present domains and sofware languages
guillermau Nov 20, 2024
28e6003
see #124 : remove blank fields
guillermau Nov 21, 2024
aedd024
see #160 : Fix naming
guillermau Nov 22, 2024
71e1572
#166 : fix naming and type
guillermau Nov 22, 2024
0ebf7a8
Merge branch 'main' into #124-improve-ui-with-new-fields
guillermau Nov 22, 2024
271eff4
fix names
guillermau Nov 22, 2024
5bd2a1f
Hide last date if no date
guillermau Nov 22, 2024
d4645f8
Fix naming in I18
guillermau Nov 22, 2024
b5e7a2c
fix format
guillermau Nov 22, 2024
ee7b983
Fix type
guillermau Nov 22, 2024
80e91ba
Fix version on wikidata not found
guillermau Nov 22, 2024
6fcb484
Merge remote-tracking branch 'origin/196-ne-plus-gérer-lédition-des-u…
guillermau Nov 25, 2024
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
2 changes: 1 addition & 1 deletion api/src/core/adapters/wikidata/getWikidataSoftware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const getWikidataSoftware: GetSoftwareExternalData = memoize(
})()
)
),
softwareVersion: <string>versionClaim.mainsnak.datavalue.value,
softwareVersion: versionClaim?.mainsnak?.datavalue?.value as string | undefined,
keywords: getClaimDataValue<"string">("P921"),
programmingLanguages: programmingLanguageString ? [programmingLanguageString] : [],
applicationCategories: undefined, // doesn't exit on wiki data
Expand Down
19 changes: 15 additions & 4 deletions web/src/core/usecases/softwareCatalog/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,9 @@ function apiSoftwareToInternalSoftware(params: {
softwareType,
userAndReferentCountByOrganization,
similarSoftwares,
keywords
keywords,
programmingLanguages,
applicationCategories
} = apiSoftware;

assert<
Expand Down Expand Up @@ -765,7 +767,10 @@ function apiSoftwareToInternalSoftware(params: {
logoUrl,
softwareName,
softwareDescription,
latestVersion,
latestVersion: {
semVer: latestVersion?.semVer ?? "",
publicationTime: latestVersion?.publicationTime
},
"referentCount": Object.values(userAndReferentCountByOrganization)
.map(({ referentCount }) => referentCount)
.reduce((prev, curr) => prev + curr, 0),
Expand Down Expand Up @@ -806,7 +811,9 @@ function apiSoftwareToInternalSoftware(params: {

return search;
})(),
userDeclaration
userDeclaration,
programmingLanguages,
applicationCategories
};
}

Expand Down Expand Up @@ -837,6 +844,8 @@ function internalSoftwareToExternalSoftware(params: {
parentSoftware,
softwareType,
userDeclaration,
programmingLanguages,
applicationCategories,
...rest
} = internalSoftware;

Expand Down Expand Up @@ -870,7 +879,9 @@ function internalSoftwareToExternalSoftware(params: {
"searchChars": search.normalize().split(""),
"highlightedIndexes": Array.from(positions)
},
userDeclaration
userDeclaration,
programmingLanguages,
applicationCategories
};
}

Expand Down
2 changes: 2 additions & 0 deletions web/src/core/usecases/softwareCatalog/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export namespace State {
isReferent: boolean;
}
| undefined;
programmingLanguages: string[];
applicationCategories: string[];
};

export type External = Common & {
Expand Down
13 changes: 10 additions & 3 deletions web/src/core/usecases/softwareCatalog/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ function apiSoftwareToInternalSoftware(params: {
softwareType,
userAndReferentCountByOrganization,
similarSoftwares,
keywords
keywords,
programmingLanguages,
applicationCategories
} = apiSoftware;

assert<
Expand Down Expand Up @@ -287,7 +289,10 @@ function apiSoftwareToInternalSoftware(params: {
logoUrl,
softwareName,
softwareDescription,
latestVersion,
latestVersion: {
semVer: latestVersion?.semVer ?? "",
publicationTime: latestVersion?.publicationTime
},
"referentCount": Object.values(userAndReferentCountByOrganization)
.map(({ referentCount }) => referentCount)
.reduce((prev, curr) => prev + curr, 0),
Expand Down Expand Up @@ -328,7 +333,9 @@ function apiSoftwareToInternalSoftware(params: {

return search;
})(),
userDeclaration
userDeclaration,
programmingLanguages,
applicationCategories
};
}

Expand Down
3 changes: 3 additions & 0 deletions web/src/core/usecases/softwareDetails/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export namespace State {
}
| SimilarSoftwareNotInSill
)[];
programmingLanguages: string[];
keywords: string[];
applicationCategories: string[];
};
}

Expand Down
15 changes: 12 additions & 3 deletions web/src/core/usecases/softwareDetails/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ function apiSoftwareToSoftware(params: {
softwareType,
userAndReferentCountByOrganization,
annuaireCnllServiceProviders,
serviceProviders
serviceProviders,
programmingLanguages,
keywords,
applicationCategories
} = apiSoftware;

const { resolveLocalizedString } = createResolveLocalizedString({
Expand Down Expand Up @@ -241,7 +244,10 @@ function apiSoftwareToSoftware(params: {
codeRepositoryUrl,
softwareName,
softwareDescription,
latestVersion,
latestVersion: {
semVer: latestVersion?.semVer ?? "",
publicationTime: latestVersion?.publicationTime
},
dereferencing,
serviceProviders: serviceProviders ?? [],
"referentCount": Object.values(userAndReferentCountByOrganization)
Expand Down Expand Up @@ -325,6 +331,9 @@ function apiSoftwareToSoftware(params: {
},
comptoirDuLibreServiceProviderCount,
testUrl,
versionMin
versionMin,
programmingLanguages,
keywords,
applicationCategories
};
}
10 changes: 8 additions & 2 deletions web/src/ui/i18n/i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,10 @@ const {
),
"CNLL service providers title": "CNLL service providers",
"CNLL service providers": ({ count }) =>
`See the ${count} service providers on the CNLL index`
`See the ${count} service providers on the CNLL index`,
"programming languages": "Coded in",
"keywords": "Keywords",
"application categories": "Categories"
},
"ReferencedInstancesTab": {
"publicInstanceCount": ({ instanceCount, organizationCount }) =>
Expand Down Expand Up @@ -1245,7 +1248,10 @@ const {
),
"CNLL service providers title": "Prestataires de services CNLL",
"CNLL service providers": ({ count }) =>
`Voir les ${count} prestataires de l'annuaire CNLL`
`Voir les ${count} prestataires de l'annuaire CNLL`,
"programming languages": "Language de programmation",
"keywords": "Mots clés",
"application categories": "Catégories"
},
"ReferencedInstancesTab": {
"publicInstanceCount": ({ instanceCount, organizationCount }) => {
Expand Down
31 changes: 17 additions & 14 deletions web/src/ui/pages/softwareCatalog/SoftwareCatalogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,23 @@ export const SoftwareCatalogCard = memo((props: Props) => {
classes.softwareVersionContainer
)}
>
{t("latest version", { fromNowText })}
<span
className={cx(
fr.cx(
"fr-badge--no-icon",
"fr-badge--yellow-tournesol",
"fr-badge",
"fr-badge--sm"
),
classes.badgeVersion
)}
>
{latestVersion.semVer}
</span>
{latestVersion?.publicationTime &&
t("latest version", { fromNowText })}
{latestVersion?.semVer && (
<span
className={cx(
fr.cx(
"fr-badge--no-icon",
"fr-badge--yellow-tournesol",
"fr-badge",
"fr-badge--sm"
),
classes.badgeVersion
)}
>
{latestVersion?.semVer}
</span>
)}
</p>
)}
</div>
Expand Down
113 changes: 78 additions & 35 deletions web/src/ui/pages/softwareDetails/PreviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export type Props = {
isPresentInSupportMarket: boolean | undefined;
isFromFrenchPublicService: boolean | undefined;
isRGAACompliant?: boolean | undefined;
programmingLanguages: string[];
keywords?: string[];
applicationCategories: string[];
};
export const PreviewTab = (props: Props) => {
const {
Expand All @@ -51,7 +54,10 @@ export const PreviewTab = (props: Props) => {
comptoirDuLibreServiceProvidersUrl,
annuaireCnllServiceProviders,
comptoireDuLibreUrl,
wikiDataUrl
wikiDataUrl,
programmingLanguages,
keywords,
applicationCategories
} = props;

const { classes, cx } = useStyles();
Expand All @@ -67,11 +73,47 @@ export const PreviewTab = (props: Props) => {
<p className={cx(fr.cx("fr-text--bold"), classes.item)}>
{t("about")}
</p>
{softwareDateCurrentVersion && (
{(softwareCurrentVersion || softwareDateCurrentVersion) && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>
{t("last version")}
</span>
{softwareCurrentVersion && (
<span
className={cx(
fr.cx(
"fr-badge",
"fr-badge--yellow-tournesol",
"fr-badge--sm"
),
classes.badgeVersion
)}
>
{softwareCurrentVersion}
</span>
)}

{softwareDateCurrentVersion &&
capitalize(
shortEndMonthDate({
"time": softwareDateCurrentVersion,
lang
})
)}
</p>
)}
{registerDate && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>{t("register")}</span>
{capitalize(monthDate({ "time": registerDate, lang }))}
</p>
)}

{minimalVersionRequired && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>
{t("minimal version")}
</span>
<span
className={cx(
fr.cx(
Expand All @@ -82,46 +124,44 @@ export const PreviewTab = (props: Props) => {
classes.badgeVersion
)}
>
{softwareCurrentVersion}
{minimalVersionRequired}
</span>
(
{capitalize(
shortEndMonthDate({
"time": softwareDateCurrentVersion,
lang
})
)}
)
</p>
)}
{registerDate && (

{license && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>{t("register")}</span>
{capitalize(monthDate({ "time": registerDate, lang }))}
<span className={classes.labelDetail}>{t("license")}</span>
<span>{license}</span>
</p>
)}

<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>
{t("minimal version")}
</span>
<span
className={cx(
fr.cx(
"fr-badge",
"fr-badge--yellow-tournesol",
"fr-badge--sm"
),
classes.badgeVersion
)}
>
{minimalVersionRequired}
</span>
</p>
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>{t("license")}</span>
<span>{license}</span>
</p>
{keywords && keywords.length > 0 && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>
{t("keywords")} :{" "}
</span>
<span>{keywords.join(", ")}</span>
</p>
)}

{programmingLanguages && programmingLanguages.length > 0 && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>
{t("programming languages")} :{" "}
</span>
<span>{programmingLanguages.join(", ")}</span>
</p>
)}

{applicationCategories && applicationCategories.length > 0 && (
<p className={cx(fr.cx("fr-text--regular"), classes.item)}>
<span className={classes.labelDetail}>
{t("application categories")} :{" "}
</span>
<span>{applicationCategories.join(", ")}</span>
</p>
)}
</div>
<div className={classes.section}>
<p className={cx(fr.cx("fr-text--bold"), classes.item)}>
Expand Down Expand Up @@ -308,4 +348,7 @@ export const { i18n } = declareComponentKeys<
| { K: "CNLL service providers"; P: { count: number } }
| "wikiData sheet"
| { K: "what is the support market"; P: { url: string }; R: JSX.Element }
| "programming languages"
| "keywords"
| "application categories"
>()({ PreviewTab });
Loading