Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ln support for inbox constants #6432

Open
wants to merge 3 commits into
base: preview
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
81 changes: 81 additions & 0 deletions packages/constants/src/inbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
export const INBOX_STATUS: {
key: string;
title: string;
description: () => string;
textColor: (snoozeDatePassed: boolean) => string;
bgColor: (snoozeDatePassed: boolean) => string;
}[] = [
{
key: "pending",
title: "inbox_issue.status.pending.title",
description: () => `inbox_issue.status.pending.description`,
textColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "text-[#AB6400]",
bgColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "bg-[#FFF7C2]",
},
{
key: "declined",
title: "inbox_issue.status.declined.title",
description: () => `inbox_issue.status.declined.description`,
textColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "text-[#CE2C31]",
bgColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "bg-[#FEEBEC]",
},
{
key: "snoozed",
title: "inbox_issue.status.snoozed.title",
description: () => `inbox_issue.status.snoozed.description`,
textColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "text-red-500" : "text-custom-text-400",
bgColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "bg-red-500/10" : "bg-[#E0E1E6]",
},
{
key: "accepted",
title: "inbox_issue.status.accepted.title",
description: () => `inbox_issue.status.accepted.description`,
textColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "text-[#3E9B4F]",
bgColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "bg-[#E9F6E9]",
},
{
key: "duplicate",
title: "inbox_issue.status.duplicate.title",
description: () => `inbox_issue.status.duplicate.description`,
textColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "text-custom-text-200",
bgColor: (snoozeDatePassed: boolean = false) =>
snoozeDatePassed ? "" : "bg-gray-500/10",
},
];

export const INBOX_ISSUE_SOURCE = "inbox_issue.source.in-app";

export const INBOX_ISSUE_ORDER_BY_OPTIONS = [
{
key: "issue__created_at",
label: "inbox_issue.order_by.created_at",
},
{
key: "issue__updated_at",
label: "inbox_issue.order_by.updated_at",
},
{
key: "issue__sequence_id",
label: "inbox_issue.order_by.id",
},
];

export const INBOX_ISSUE_SORT_BY_OPTIONS = [
{
key: "asc",
label: "common.sort.asc",
},
{
key: "desc",
label: "common.sort.desc",
},
];
1 change: 1 addition & 0 deletions packages/constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export * from "./swr";
export * from "./user";
export * from "./workspace";
export * from "./stickies";
export * from "./inbox";
40 changes: 39 additions & 1 deletion packages/i18n/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,43 @@
"change_parent_issue": "Change parent issue",
"remove_parent_issue": "Remove parent issue",
"add_parent": "Add parent",
"loading_members": "Loading members..."
"loading_members": "Loading members...",
"inbox_issue": {
"status": {
"pending": {
"title": "Pending",
"description": "Pending"
},
"declined": {
"title": "Declined",
"description": "Declined"
},
"snoozed": {
"title": "Snoozed",
"description": "{days, plural, one{# day} other{# days}} to go"
},
"accepted": {
"title": "Accepted",
"description": "Accepted"
},
"duplicate": {
"title": "Duplicate",
"description": "Duplicate"
}
},
"source": {
"in-app": "in-app"
},
"order_by": {
"created_at": "Created at",
"updated_at": "Updated at",
"id": "ID"
}
},
"common": {
"sort": {
"asc": "Ascending",
"desc": "Descending"
}
}
}
40 changes: 39 additions & 1 deletion packages/i18n/src/locales/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,43 @@
"remove_parent_issue": "Eliminar problema padre",
"add_parent": "Agregar padre",
"loading_members": "Cargando miembros...",
"inbox": "bandeja de entrada"
"inbox": "bandeja de entrada",
"inbox_issue": {
"status": {
"pending": {
"title": "Pendiente",
"description": "Pendiente"
},
"declined": {
"title": "Rechazado",
"description": "Rechazado"
},
"snoozed": {
"title": "Pospuesto",
"description": "{days, plural, one{# día} other{# días}} restantes"
},
"accepted": {
"title": "Aceptado",
"description": "Aceptado"
},
"duplicate": {
"title": "Duplicado",
"description": "Duplicado"
}
},
"source": {
"in-app": "en la aplicación"
},
"order_by": {
"created_at": "Creado el",
"updated_at": "Actualizado el",
"id": "Identificador"
}
},
"common": {
"sort": {
"asc": "Ascendente",
"desc": "Descendente"
}
}
}
40 changes: 39 additions & 1 deletion packages/i18n/src/locales/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,43 @@
"remove_parent_issue": "Supprimer le problème parent",
"add_parent": "Ajouter un parent",
"loading_members": "Chargement des membres...",
"inbox": "Boîte de réception"
"inbox": "Boîte de réception",
"inbox_issue": {
"status": {
"pending": {
"title": "En attente",
"description": "En attente"
},
"declined": {
"title": "Refusé",
"description": "Refusé"
},
"snoozed": {
"title": "Reporté",
"description": "{days, plural, one{# jour} other{# jours}} restants"
},
"accepted": {
"title": "Accepté",
"description": "Accepté"
},
"duplicate": {
"title": "Doublon",
"description": "Doublon"
}
},
"source": {
"in-app": "dans l'application"
},
"order_by": {
"created_at": "Créé le",
"updated_at": "Mis à jour le",
"id": "Identifiant"
}
},
"common": {
"sort": {
"asc": "Croissant",
"desc": "Décroissant"
}
}
}
40 changes: 39 additions & 1 deletion packages/i18n/src/locales/ja/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,43 @@
"remove_parent_issue": "親問題を削除",
"add_parent": "親問題を追加",
"loading_members": "メンバーを読み込んでいます...",
"inbox": "受信箱"
"inbox": "受信箱",
"inbox_issue": {
"status": {
"pending": {
"title": "保留中",
"description": "保留中"
},
"declined": {
"title": "却下",
"description": "却下"
},
"snoozed": {
"title": "スヌーズ中",
"description": "残り{days}日"
},
"accepted": {
"title": "承認済み",
"description": "承認済み"
},
"duplicate": {
"title": "重複",
"description": "重複"
}
},
"source": {
"in-app": "アプリ内"
},
"order_by": {
"created_at": "作成日時",
"updated_at": "更新日時",
"id": "識別番号"
}
},
"common": {
"sort": {
"asc": "昇順",
"desc": "降順"
}
}
}
40 changes: 39 additions & 1 deletion packages/i18n/src/locales/zh-CN/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,43 @@
"remove_parent_issue": "移除父问题",
"add_parent": "添加父问题",
"loading_members": "正在加载成员...",
"inbox": "收件箱"
"inbox": "收件箱",
"inbox_issue": {
"status": {
"pending": {
"title": "待处理",
"description": "待处理"
},
"declined": {
"title": "已拒绝",
"description": "已拒绝"
},
"snoozed": {
"title": "已暂停",
"description": "还剩{days}天"
},
"accepted": {
"title": "已接受",
"description": "已接受"
},
"duplicate": {
"title": "重复",
"description": "重复"
}
},
"source": {
"in-app": "应用内"
},
"order_by": {
"created_at": "创建时间",
"updated_at": "更新时间",
"id": "编号"
}
},
"common": {
"sort": {
"asc": "升序",
"desc": "降序"
}
}
}
5 changes: 1 addition & 4 deletions packages/types/src/inbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ export type TInboxIssueFilter = {
// sorting filters
export type TInboxIssueSortingKeys = "order_by" | "sort_by";

export type TInboxIssueSortingOrderByKeys =
| "issue__created_at"
| "issue__updated_at"
| "issue__sequence_id";
export type TInboxIssueSortingOrderByKeys = "issue__created_at" | "issue__updated_at" | "issue__sequence_id";

export type TInboxIssueSortingSortByKeys = "asc" | "desc";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { FC } from "react";
import { observer } from "mobx-react";
import { X } from "lucide-react";
import { useTranslation } from "@plane/i18n";
import { TInboxIssueStatus } from "@plane/types";
// constants
import { Tag } from "@plane/ui";
import { INBOX_STATUS } from "@/constants/inbox";
// hooks
import { INBOX_STATUS } from "@/helpers/inbox.helper";
import { useProjectInbox } from "@/hooks/store";

export const InboxIssueAppliedFiltersStatus: FC = observer(() => {
// hooks
const { inboxFilters, handleInboxIssueFilters } = useProjectInbox();
const { t } = useTranslation();
// derived values
const filteredValues = inboxFilters?.status || [];
const currentOptionDetail = (status: TInboxIssueStatus) => INBOX_STATUS.find((s) => s.status === status) || undefined;
Expand All @@ -30,7 +32,7 @@ export const InboxIssueAppliedFiltersStatus: FC = observer(() => {
<div className="w-3 h-3 flex-shrink-0 relative flex justify-center items-center overflow-hidden">
<optionDetail.icon className={`w-3 h-3 ${optionDetail?.textColor(false)}`} />
</div>
<div className="text-xs truncate">{optionDetail?.title}</div>
<div className="text-xs truncate">{t(optionDetail?.title)}</div>
{handleFilterValue(optionDetail?.status).length >= 1 && (
<div
className="w-3 h-3 flex-shrink-0 relative flex justify-center items-center overflow-hidden cursor-pointer text-custom-text-300 hover:text-custom-text-200 transition-all"
Expand Down
6 changes: 4 additions & 2 deletions web/core/components/inbox/inbox-filter/filters/status.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { FC, useState } from "react";
import { observer } from "mobx-react";
// types
import { useTranslation } from "@plane/i18n";
import { TInboxIssueStatus } from "@plane/types";
// components
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { INBOX_STATUS } from "@/constants/inbox";
// hooks
import { INBOX_STATUS } from "@/helpers/inbox.helper";
import { useProjectInbox } from "@/hooks/store/use-project-inbox";

type Props = {
Expand All @@ -17,6 +18,7 @@ export const FilterStatus: FC<Props> = observer((props) => {
const { searchQuery } = props;
// hooks
const { currentTab, inboxFilters, handleInboxIssueFilters } = useProjectInbox();
const { t } = useTranslation();
// states
const [previewEnabled, setPreviewEnabled] = useState(true);
// derived values
Expand Down Expand Up @@ -53,7 +55,7 @@ export const FilterStatus: FC<Props> = observer((props) => {
isChecked={filterValue?.includes(status.status) ? true : false}
onClick={() => handleStatusFilterSelect(status.status)}
icon={<status.icon className={`h-3.5 w-3.5 ${status?.textColor(false)}`} />}
title={status.title}
title={t(status.title)}
/>
))
) : (
Expand Down
Loading
Loading