Skip to content

Commit aa2525f

Browse files
committed
Hide dl button if no texts
1 parent b32f2cc commit aa2525f

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

Client/Js/LpManager/Components/Packs/PackageVersionRow.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ interface IPackageVersionRowProps {
1212
}
1313

1414
const PackageVersionRow: React.FC<IPackageVersionRowProps> = (props) => {
15-
var textStat =
16-
props.textStat.length > 0 ? (
15+
let textStat = <span></span>;
16+
let hasTexts = false;
17+
if (props.textStat.length > 0) {
18+
textStat = (
1719
<span>
1820
{props.textStat[0].NrTexts}/{props.packageVersion.NrTexts} (
1921
{(
@@ -22,19 +24,25 @@ const PackageVersionRow: React.FC<IPackageVersionRowProps> = (props) => {
2224
).toFixed(0)}{" "}
2325
%)
2426
</span>
25-
) : null;
27+
);
28+
if (props.textStat[0].NrTexts > 0) {
29+
hasTexts = true;
30+
}
31+
}
2632
const date = new Date(props.packageVersion.ReleaseDate);
2733
return (
2834
<tr>
2935
<td>{props.packageVersion.Version}</td>
3036
<td>{textStat}</td>
3137
<td>{new Intl.DateTimeFormat(props.contextLocale).format(date)}</td>
3238
<td>
33-
<a
34-
href={`${props.baseServicepath}Packs/Get?packageName=${props.packageVersion.PackageName}&version=${props.packageVersion.Version}&locale=${props.locale}`}
35-
>
36-
{props.resources.Download}
37-
</a>
39+
{hasTexts ? (
40+
<a
41+
href={`${props.baseServicepath}Packs/Get?packageName=${props.packageVersion.PackageName}&version=${props.packageVersion.Version}&locale=${props.locale}`}
42+
>
43+
{props.resources.Download}
44+
</a>
45+
) : null}
3846
</td>
3947
</tr>
4048
);

0 commit comments

Comments
 (0)