Skip to content

Commit f5ca669

Browse files
authored
feat(share): add a tooltip to hint no permission (#218)
1 parent 9c2e25d commit f5ca669

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/lang/en/shares.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
"back": "Extract to back"
3737
},
3838
"input_password": "Please input share code",
39-
"copy_msg": "Copy link"
39+
"copy_msg": "Copy link",
40+
"no_permission_tip": "To create a share, you need \"Share\" permission."
4041
}

src/pages/manage/shares/Shares.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Tbody,
77
Th,
88
Thead,
9+
Tooltip,
910
Tr,
1011
VStack,
1112
} from "@hope-ui/solid"
@@ -51,14 +52,22 @@ const Shares = () => {
5152
>
5253
{t("global.refresh")}
5354
</Button>
54-
<Button
55-
disabled={!canShare}
56-
onClick={() => {
57-
to("/@manage/shares/add")
58-
}}
55+
<Show
56+
when={!canShare}
57+
fallback={
58+
<Button onClick={() => to("/@manage/shares/add")}>
59+
{t("global.add")}
60+
</Button>
61+
}
5962
>
60-
{t("global.add")}
61-
</Button>
63+
<Tooltip
64+
withArrow
65+
label={t("shares.no_permission_tip")}
66+
placement="right"
67+
>
68+
<Button disabled> {t("global.add")} </Button>
69+
</Tooltip>
70+
</Show>
6271
</HStack>
6372
<Box w="$full" overflowX="auto">
6473
<Table highlightOnHover dense>

0 commit comments

Comments
 (0)