IO-3166-Global-Notifications-Part-2 - Checkpoint - job watchers styling

This commit is contained in:
Dave Richer
2025-03-05 21:05:24 -05:00
parent fbe674a2e5
commit 21335d4e8c
5 changed files with 41 additions and 27 deletions

View File

@@ -4,6 +4,7 @@ import { Avatar, Button, Divider, List, Popover, Select, Tooltip, Typography } f
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import EmployeeSearchSelectComponent from "../../components/employee-search-select/employee-search-select.component.jsx"; import EmployeeSearchSelectComponent from "../../components/employee-search-select/employee-search-select.component.jsx";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component.jsx"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component.jsx";
import { BiSolidTrash } from "react-icons/bi";
const { Text } = Typography; const { Text } = Typography;
@@ -42,7 +43,8 @@ export default function JobWatcherToggleComponent({
<Button <Button
type="default" type="default"
danger danger
size="small" size="medium"
icon={<BiSolidTrash />}
onClick={() => handleRemoveWatcher(watcher.user_email)} onClick={() => handleRemoveWatcher(watcher.user_email)}
disabled={adding || removing} // Optional: Disable button during mutations disabled={adding || removing} // Optional: Disable button during mutations
> >
@@ -61,20 +63,28 @@ export default function JobWatcherToggleComponent({
const popoverContent = ( const popoverContent = (
<div style={{ width: 600 }}> <div style={{ width: 600 }}>
<Button <List>
block <List.Item
type={isWatching ? "primary" : "default"} actions={[
icon={isWatching ? <EyeOutlined /> : <EyeFilled />} <Button
onClick={handleToggleSelf} type={isWatching ? "primary" : "default"}
loading={adding || removing} danger={!isWatching}
> icon={isWatching ? <EyeOutlined /> : <EyeFilled />}
{isWatching ? t("notifications.tooltips.unwatch") : t("notifications.tooltips.watch")} size="medium"
</Button> onClick={handleToggleSelf}
<Divider /> loading={adding || removing}
>
<Text type="secondary" style={{ marginBottom: 8, display: "block" }}> {isWatching ? t("notifications.labels.unwatch") : t("notifications.labels.watch")}
{t("notifications.labels.watching-issue")} </Button>
</Text> ]}
>
<List.Item.Meta>
<Text type="secondary" style={{ marginBottom: 8, display: "block" }}>
{t("notifications.labels.watching-issue")}
</Text>
</List.Item.Meta>
</List.Item>
</List>
{watcherLoading ? ( {watcherLoading ? (
<LoadingSpinner /> <LoadingSpinner />
) : jobWatchers && jobWatchers.length > 0 ? ( ) : jobWatchers && jobWatchers.length > 0 ? (
@@ -82,8 +92,8 @@ export default function JobWatcherToggleComponent({
) : ( ) : (
<Text type="secondary">{t("notifications.labels.no-watchers")}</Text> <Text type="secondary">{t("notifications.labels.no-watchers")}</Text>
)} )}
<Divider />
<Divider />
<Text type="secondary">{t("notifications.labels.add-watchers")}</Text> <Text type="secondary">{t("notifications.labels.add-watchers")}</Text>
<EmployeeSearchSelectComponent <EmployeeSearchSelectComponent
style={{ minWidth: "100%" }} style={{ minWidth: "100%" }}
@@ -128,7 +138,7 @@ export default function JobWatcherToggleComponent({
return ( return (
<Popover content={popoverContent} trigger="click" open={open} onOpenChange={setOpen}> <Popover content={popoverContent} trigger="click" open={open} onOpenChange={setOpen}>
<Tooltip title={isWatching ? t("notifications.tooltips.unwatch") : t("notifications.tooltips.watch")}> <Tooltip title={t("notifications.tooltips.job-watchers")}>
<Button <Button
shape="circle" shape="circle"
type={isWatching ? "primary" : "default"} type={isWatching ? "primary" : "default"}

View File

@@ -211,6 +211,7 @@ function JobWatcherToggleContainer({ job, currentUser, bodyshop }) {
handleRemoveWatcher={handleRemoveWatcher} handleRemoveWatcher={handleRemoveWatcher}
handleWatcherSelect={handleWatcherSelect} handleWatcherSelect={handleWatcherSelect}
handleTeamSelect={handleTeamSelect} handleTeamSelect={handleTeamSelect}
currentUser={currentUser}
/> />
); );
} }

View File

@@ -3785,17 +3785,18 @@
"ro-number": "RO #{{ro_number}}", "ro-number": "RO #{{ro_number}}",
"no-watchers": "No Watchers", "no-watchers": "No Watchers",
"notification-settings-success": "Notification Settings saved successfully.", "notification-settings-success": "Notification Settings saved successfully.",
"notification-settings-failure": "Error saving Notification Settings. {{error}}" "notification-settings-failure": "Error saving Notification Settings. {{error}}",
"watch": "Watch",
"unwatch": "Unwatch"
}, },
"actions": { "actions": {
"remove": "remove" "remove": "Remove"
}, },
"aria": { "aria": {
"toggle": "Toggle Watching Job" "toggle": "Toggle Watching Job"
}, },
"tooltips": { "tooltips": {
"watch": "Watch Job", "job-watchers": "Job Watchers"
"unwatch": "Unwatch Job"
}, },
"scenarios": { "scenarios": {
"job-assigned-to-me": "Job Assigned to Me", "job-assigned-to-me": "Job Assigned to Me",

View File

@@ -3785,7 +3785,9 @@
"ro-number": "", "ro-number": "",
"no-watchers": "", "no-watchers": "",
"notification-settings-success": "", "notification-settings-success": "",
"notification-settings-failure": "" "notification-settings-failure": "",
"watch": "",
"unwatch": ""
}, },
"actions": { "actions": {
"remove": "" "remove": ""
@@ -3794,8 +3796,7 @@
"toggle": "" "toggle": ""
}, },
"tooltips": { "tooltips": {
"watch": "", "job-watchers": ""
"unwatch": ""
}, },
"scenarios": { "scenarios": {
"job-assigned-to-me": "", "job-assigned-to-me": "",

View File

@@ -3785,7 +3785,9 @@
"ro-number": "", "ro-number": "",
"no-watchers": "", "no-watchers": "",
"notification-settings-success": "", "notification-settings-success": "",
"notification-settings-failure": "" "notification-settings-failure": "",
"watch": "",
"unwatch": ""
}, },
"actions": { "actions": {
"remove": "" "remove": ""
@@ -3794,8 +3796,7 @@
"toggle": "" "toggle": ""
}, },
"tooltips": { "tooltips": {
"watch": "", "job-watchers": ""
"unwatch": ""
}, },
"scenarios": { "scenarios": {
"job-assigned-to-me": "", "job-assigned-to-me": "",