fix: show Workshop voting as net score
This commit is contained in:
2 files changed
+33
-23
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
import { useEffect, useId, useMemo, useState } from "react";
|
import { useEffect, useId, useMemo, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Accordion,
|
Accordion,
|
||||||
|
ActionIcon,
|
||||||
Alert,
|
Alert,
|
||||||
Badge,
|
Badge,
|
||||||
Box,
|
Box,
|
||||||
@@ -39,8 +40,6 @@ import {
|
|||||||
IconMessageCircle,
|
IconMessageCircle,
|
||||||
IconRefresh,
|
IconRefresh,
|
||||||
IconSearch,
|
IconSearch,
|
||||||
IconThumbDown,
|
|
||||||
IconThumbUp,
|
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { CUSTOM_WIDGET_SCHEMA } from "@homarr/custom-widgets/core";
|
import { CUSTOM_WIDGET_SCHEMA } from "@homarr/custom-widgets/core";
|
||||||
import type { HomarrCustomWidgetV2 } from "@homarr/custom-widgets/core";
|
import type { HomarrCustomWidgetV2 } from "@homarr/custom-widgets/core";
|
||||||
@@ -526,28 +525,38 @@ export function WorkshopBrowser({ type = "customWidget", onInstall, onUseCss, mo
|
|||||||
>
|
>
|
||||||
{t("export")}
|
{t("export")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Group
|
||||||
variant="subtle"
|
gap={4}
|
||||||
size="compact-sm"
|
wrap="nowrap"
|
||||||
leftSection={<IconThumbUp size={16} />}
|
p={4}
|
||||||
loading={vote.isPending && vote.variables?.value === 1}
|
bg="var(--mantine-color-default-hover)"
|
||||||
disabled={!user || vote.isPending}
|
style={{ borderRadius: "var(--mantine-radius-md)" }}
|
||||||
aria-label={t("upvote", { count: detail.data.upvotes })}
|
|
||||||
onClick={() => vote.mutate({ submission: detail.data.id, value: 1 })}
|
|
||||||
>
|
>
|
||||||
{detail.data.upvotes}
|
<ActionIcon
|
||||||
</Button>
|
variant="subtle"
|
||||||
<Button
|
color="red"
|
||||||
variant="subtle"
|
size="lg"
|
||||||
size="compact-sm"
|
loading={vote.isPending && vote.variables?.value === 1}
|
||||||
leftSection={<IconThumbDown size={16} />}
|
disabled={!user || vote.isPending}
|
||||||
loading={vote.isPending && vote.variables?.value === -1}
|
aria-label={t("upvote", { count: detail.data.upvotes })}
|
||||||
disabled={!user || vote.isPending}
|
onClick={() => vote.mutate({ submission: detail.data.id, value: 1 })}
|
||||||
aria-label={t("downvote", { count: detail.data.downvotes })}
|
>
|
||||||
onClick={() => vote.mutate({ submission: detail.data.id, value: -1 })}
|
<IconArrowBigUp size={20} />
|
||||||
>
|
</ActionIcon>
|
||||||
{detail.data.downvotes}
|
<Text miw={24} ta="center" fw={700} aria-label={t("score", { count: detail.data.score })}>
|
||||||
</Button>
|
{detail.data.score}
|
||||||
|
</Text>
|
||||||
|
<ActionIcon
|
||||||
|
variant="subtle"
|
||||||
|
size="lg"
|
||||||
|
loading={vote.isPending && vote.variables?.value === -1}
|
||||||
|
disabled={!user || vote.isPending}
|
||||||
|
aria-label={t("downvote", { count: detail.data.downvotes })}
|
||||||
|
onClick={() => vote.mutate({ submission: detail.data.id, value: -1 })}
|
||||||
|
>
|
||||||
|
<IconArrowBigDown size={20} />
|
||||||
|
</ActionIcon>
|
||||||
|
</Group>
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
size="compact-sm"
|
size="compact-sm"
|
||||||
|
|||||||
@@ -1418,6 +1418,7 @@
|
|||||||
"screenshotAlt": "{title} screenshot {count, number}",
|
"screenshotAlt": "{title} screenshot {count, number}",
|
||||||
"upvote": "Upvote, {count, plural, one {# vote} other {# votes}}",
|
"upvote": "Upvote, {count, plural, one {# vote} other {# votes}}",
|
||||||
"downvote": "Downvote, {count, plural, one {# vote} other {# votes}}",
|
"downvote": "Downvote, {count, plural, one {# vote} other {# votes}}",
|
||||||
|
"score": "Score: {count, number}",
|
||||||
"inspectCss": "Inspect CSS",
|
"inspectCss": "Inspect CSS",
|
||||||
"technicalDetails": "Technical details",
|
"technicalDetails": "Technical details",
|
||||||
"sourceCode": "Workshop entry",
|
"sourceCode": "Workshop entry",
|
||||||
|
|||||||
Reference in new issue
Block a user