Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ export const useWorkItemCommentOperations = (
if (!workspaceSlug || !projectId || !commentId) throw new Error("Missing fields");
await createCommentReaction(workspaceSlug, projectId, commentId, reaction);
setToast({
title: "Success!",
title: t("toast.success"),
type: TOAST_TYPE.SUCCESS,
message: "Reaction created successfully",
message: t("reactions.toasts.created"),
});
} catch {
setToast({
title: "Error!",
title: t("toast.error"),
type: TOAST_TYPE.ERROR,
message: "Reaction creation failed",
message: t("reactions.toasts.creation_failed"),
});
}
},
Expand All @@ -179,15 +179,15 @@ export const useWorkItemCommentOperations = (
if (!workspaceSlug || !projectId || !commentId || !currentUser?.id) throw new Error("Missing fields");
removeCommentReaction(workspaceSlug, projectId, commentId, reaction, currentUser.id);
setToast({
title: "Success!",
title: t("toast.success"),
type: TOAST_TYPE.SUCCESS,
message: "Reaction removed successfully",
message: t("reactions.toasts.removed"),
});
} catch {
setToast({
title: "Error!",
title: t("toast.error"),
type: TOAST_TYPE.ERROR,
message: "Reaction remove failed",
message: t("reactions.toasts.remove_failed"),
});
}
},
Expand Down
29 changes: 16 additions & 13 deletions apps/web/core/components/issues/issue-detail/links/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useCallback, useMemo, useState } from "react";

import { PlusIcon } from "@plane/propel/icons";
// plane imports
import { useTranslation } from "@plane/i18n";
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
import type { TIssueLink } from "@plane/types";
import { EIssueServiceType } from "@plane/types";
Expand All @@ -33,6 +34,8 @@ export type TIssueLinkRoot = {
export function IssueLinkRoot(props: TIssueLinkRoot) {
// props
const { workspaceSlug, projectId, issueId, disabled = false } = props;
// translation
const { t } = useTranslation();
// hooks
const { toggleIssueLinkModal: toggleIssueLinkModalStore, createLink, updateLink, removeLink } = useIssueDetail();
// state
Expand All @@ -52,16 +55,16 @@ export function IssueLinkRoot(props: TIssueLinkRoot) {
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
await createLink(workspaceSlug, projectId, issueId, data);
setToast({
message: "The link has been successfully created",
message: t("links.toasts.created.message"),
type: TOAST_TYPE.SUCCESS,
title: "Link created",
title: t("links.toasts.created.title"),
});
toggleIssueLinkModal(false);
} catch (error: any) {
setToast({
message: error?.data?.error ?? "The link could not be created",
message: error?.data?.error ?? t("links.toasts.not_created.message"),
type: TOAST_TYPE.ERROR,
title: "Link not created",
title: t("links.toasts.not_created.title"),
});
throw error;
}
Expand All @@ -71,16 +74,16 @@ export function IssueLinkRoot(props: TIssueLinkRoot) {
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
await updateLink(workspaceSlug, projectId, issueId, linkId, data);
setToast({
message: "The link has been successfully updated",
message: t("links.toasts.updated.message"),
type: TOAST_TYPE.SUCCESS,
title: "Link updated",
title: t("links.toasts.updated.title"),
});
toggleIssueLinkModal(false);
} catch (error) {
setToast({
message: "The link could not be updated",
message: t("links.toasts.not_updated.message"),
type: TOAST_TYPE.ERROR,
title: "Link not updated",
title: t("links.toasts.not_updated.title"),
});
throw error;
}
Expand All @@ -90,21 +93,21 @@ export function IssueLinkRoot(props: TIssueLinkRoot) {
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing required fields");
await removeLink(workspaceSlug, projectId, issueId, linkId);
setToast({
message: "The link has been successfully removed",
message: t("links.toasts.removed.message"),
type: TOAST_TYPE.SUCCESS,
title: "Link removed",
title: t("links.toasts.removed.title"),
});
toggleIssueLinkModal(false);
} catch {
setToast({
message: "The link could not be removed",
message: t("links.toasts.not_removed.message"),
type: TOAST_TYPE.ERROR,
title: "Link not removed",
title: t("links.toasts.not_removed.title"),
});
}
},
}),
[workspaceSlug, projectId, issueId, createLink, updateLink, removeLink, toggleIssueLinkModal]
[workspaceSlug, projectId, issueId, createLink, updateLink, removeLink, toggleIssueLinkModal, t]
);

const handleOnClose = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { observer } from "mobx-react";
import { stringToEmoji } from "@plane/propel/emoji-icon-picker";
import { EmojiReactionGroup, EmojiReactionPicker } from "@plane/propel/emoji-reaction";
import type { EmojiReactionType } from "@plane/propel/emoji-reaction";
import { useTranslation } from "@plane/i18n";
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
import type { IUser } from "@plane/types";
// hooks
Expand All @@ -34,6 +35,8 @@ export const IssueCommentReaction = observer(function IssueCommentReaction(props
removeCommentReaction,
} = useIssueDetail();
const { getUserDetails } = useMember();
// translation
const { t } = useTranslation();

const reactionIds = getCommentReactionsByCommentId(commentId);
const userReactions = commentReactionsByUser(commentId, currentUser.id).map((r) => r.reaction);
Expand All @@ -45,15 +48,15 @@ export const IssueCommentReaction = observer(function IssueCommentReaction(props
if (!workspaceSlug || !projectId || !commentId) throw new Error("Missing fields");
await createCommentReaction(workspaceSlug, projectId, commentId, reaction);
setToast({
title: "Success!",
title: t("toast.success"),
type: TOAST_TYPE.SUCCESS,
message: "Reaction created successfully",
message: t("reactions.toasts.created"),
});
} catch (_error) {
setToast({
title: "Error!",
title: t("toast.error"),
type: TOAST_TYPE.ERROR,
message: "Reaction creation failed",
message: t("reactions.toasts.creation_failed"),
});
}
},
Expand All @@ -62,15 +65,15 @@ export const IssueCommentReaction = observer(function IssueCommentReaction(props
if (!workspaceSlug || !projectId || !commentId || !currentUser?.id) throw new Error("Missing fields");
removeCommentReaction(workspaceSlug, projectId, commentId, reaction, currentUser.id);
setToast({
title: "Success!",
title: t("toast.success"),
type: TOAST_TYPE.SUCCESS,
message: "Reaction removed successfully",
message: t("reactions.toasts.removed"),
});
} catch (_error) {
setToast({
title: "Error!",
title: t("toast.error"),
type: TOAST_TYPE.ERROR,
message: "Reaction remove failed",
message: t("reactions.toasts.remove_failed"),
});
}
},
Expand All @@ -79,7 +82,7 @@ export const IssueCommentReaction = observer(function IssueCommentReaction(props
else await issueCommentReactionOperations.create(reaction);
},
}),
[workspaceSlug, projectId, commentId, currentUser, createCommentReaction, removeCommentReaction, userReactions]
[workspaceSlug, projectId, commentId, currentUser, createCommentReaction, removeCommentReaction, userReactions, t]
);

const getReactionUsers = (reaction: string): string[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { observer } from "mobx-react";
import { stringToEmoji } from "@plane/propel/emoji-icon-picker";
import { EmojiReactionGroup, EmojiReactionPicker } from "@plane/propel/emoji-reaction";
import type { EmojiReactionType } from "@plane/propel/emoji-reaction";
import { useTranslation } from "@plane/i18n";
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
import type { IUser } from "@plane/types";
// hooks
Expand Down Expand Up @@ -39,6 +40,8 @@ export const IssueReaction = observer(function IssueReaction(props: TIssueReacti
removeReaction,
} = useIssueDetail();
const { getUserDetails } = useMember();
// translation
const { t } = useTranslation();

const reactionIds = getReactionsByIssueId(issueId);
const userReactions = reactionsByUser(issueId, currentUser.id).map((r) => r.reaction);
Expand All @@ -50,15 +53,15 @@ export const IssueReaction = observer(function IssueReaction(props: TIssueReacti
if (!workspaceSlug || !projectId || !issueId) throw new Error("Missing fields");
await createReaction(workspaceSlug, projectId, issueId, reaction);
setToast({
title: "Success!",
title: t("toast.success"),
type: TOAST_TYPE.SUCCESS,
message: "Reaction created successfully",
message: t("reactions.toasts.created"),
});
} catch (_error) {
setToast({
title: "Error!",
title: t("toast.error"),
type: TOAST_TYPE.ERROR,
message: "Reaction creation failed",
message: t("reactions.toasts.creation_failed"),
});
}
},
Expand All @@ -67,15 +70,15 @@ export const IssueReaction = observer(function IssueReaction(props: TIssueReacti
if (!workspaceSlug || !projectId || !issueId || !currentUser?.id) throw new Error("Missing fields");
await removeReaction(workspaceSlug, projectId, issueId, reaction, currentUser.id);
setToast({
title: "Success!",
title: t("toast.success"),
type: TOAST_TYPE.SUCCESS,
message: "Reaction removed successfully",
message: t("reactions.toasts.removed"),
});
} catch (_error) {
setToast({
title: "Error!",
title: t("toast.error"),
type: TOAST_TYPE.ERROR,
message: "Reaction remove failed",
message: t("reactions.toasts.remove_failed"),
});
}
},
Expand All @@ -84,7 +87,7 @@ export const IssueReaction = observer(function IssueReaction(props: TIssueReacti
else await issueReactionOperations.create(reaction);
},
}),
[workspaceSlug, projectId, issueId, currentUser, createReaction, removeReaction, userReactions]
[workspaceSlug, projectId, issueId, currentUser, createReaction, removeReaction, userReactions, t]
);

const getReactionUsers = (reaction: string): string[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Link from "next/link";

import { EditIcon, CloseIcon } from "@plane/propel/icons";
// Plane
import { useTranslation } from "@plane/i18n";
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
import { Tooltip } from "@plane/propel/tooltip";
import type { ISearchIssueResponse } from "@plane/types";
Expand Down Expand Up @@ -48,15 +49,17 @@ export const IssueRelationSelect = observer(function IssueRelationSelect(props:
} = useIssueDetail();
const { issueMap } = useIssues();
const { isMobile } = usePlatformOS();
// translation
const { t } = useTranslation();
const relationIssueIds = getRelationByIssueIdRelationType(issueId, relationKey);
const ISSUE_RELATION_OPTIONS = useTimeLineRelationOptions();

const onSubmit = async (data: ISearchIssueResponse[]) => {
if (data.length === 0) {
setToast({
type: TOAST_TYPE.ERROR,
title: "Error!",
message: "Please select at least one work item.",
title: t("toast.error"),
message: t("please_select_at_least_one_work_item"),
});
return;
}
Expand Down Expand Up @@ -119,7 +122,7 @@ export const IssueRelationSelect = observer(function IssueRelationSelect(props:
key={relationIssueId}
className={`group flex items-center gap-1 rounded-sm px-1.5 pt-1 pb-1 leading-3 hover:bg-surface-2 ${currRelationOption?.className}`}
>
<Tooltip tooltipHeading="Title" tooltipContent={currentIssue.name} isMobile={isMobile}>
<Tooltip tooltipHeading={t("title")} tooltipContent={currentIssue.name} isMobile={isMobile}>
<Link
href={generateWorkItemLink({
workspaceSlug,
Expand All @@ -137,7 +140,7 @@ export const IssueRelationSelect = observer(function IssueRelationSelect(props:
</Link>
</Tooltip>
{!disabled && (
<Tooltip tooltipContent="Remove" position="bottom" isMobile={isMobile}>
<Tooltip tooltipContent={t("remove")} position="bottom" isMobile={isMobile}>
{/* eslint-disable-next-line jsx_a11y/click-events-have-key-events oxlint-disable-next-line jsx_a11y/no-static-element-interactions */}
<span
onClick={(e) => {
Expand Down
15 changes: 13 additions & 2 deletions apps/web/core/components/profile/start-of-week-preference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { observer } from "mobx-react";
// plane imports
import { START_OF_THE_WEEK_OPTIONS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
import type { EStartOfTheWeek } from "@plane/types";
import { CustomSelect } from "@plane/ui";
Expand All @@ -23,13 +24,23 @@ export const StartOfWeekPreference = observer(function StartOfWeekPreference(pro
}) {
// hooks
const { data: userProfile, updateUserProfile } = useUserProfile();
// translation
const { t } = useTranslation();

const handleStartOfWeekChange = async (val: number) => {
try {
await updateUserProfile({ start_of_the_week: val });
setToast({ type: TOAST_TYPE.SUCCESS, title: "Success", message: "First day of the week updated successfully" });
setToast({
type: TOAST_TYPE.SUCCESS,
title: t("toast.success"),
message: t("account_settings.preferences.toasts.start_of_week_updated"),
});
} catch (_error) {
setToast({ type: TOAST_TYPE.ERROR, title: "Update failed", message: "Please try again later." });
setToast({
type: TOAST_TYPE.ERROR,
title: t("toast.error"),
message: t("account_settings.preferences.toasts.start_of_week_update_failed"),
});
}
};

Expand Down
Loading