Skip to content

Commit

Permalink
chore: ln support for cycles constant file
Browse files Browse the repository at this point in the history
  • Loading branch information
gakshita committed Jan 17, 2025
1 parent 95f43a7 commit 7bae987
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 35 deletions.
32 changes: 8 additions & 24 deletions web/core/constants/cycle.ts → packages/constants/src/cycle.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
// types
import { TCycleLayoutOptions, TCycleTabOptions } from "@plane/types";

export const CYCLE_TABS_LIST: {
key: TCycleTabOptions;
name: string;
}[] = [
{
key: "active",
name: "Active",
},
{
key: "all",
name: "All",
},
];

export const CYCLE_STATUS: {
label: string;
value: "current" | "upcoming" | "completed" | "draft";
Expand All @@ -24,33 +8,33 @@ export const CYCLE_STATUS: {
bgColor: string;
}[] = [
{
label: "day left",
label: "project_cycles.status.days_left",
value: "current",
title: "In progress",
title: "project_cycles.status.in_progress",
color: "#F59E0B",
textColor: "text-amber-500",
bgColor: "bg-amber-50",
},
{
label: "Yet to start",
label: "project_cycles.status.yet_to_start",
value: "upcoming",
title: "Yet to start",
title: "project_cycles.status.yet_to_start",
color: "#3F76FF",
textColor: "text-blue-500",
bgColor: "bg-indigo-50",
},
{
label: "Completed",
label: "project_cycles.status.completed",
value: "completed",
title: "Completed",
title: "project_cycles.status.completed",
color: "#16A34A",
textColor: "text-green-600",
bgColor: "bg-green-50",
},
{
label: "Draft",
label: "project_cycles.status.draft",
value: "draft",
title: "Draft",
title: "project_cycles.status.draft",
color: "#525252",
textColor: "text-custom-text-300",
bgColor: "bg-custom-background-90",
Expand Down
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 "./cycle";
12 changes: 11 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,15 @@
"change_parent_issue": "Change parent issue",
"remove_parent_issue": "Remove parent issue",
"add_parent": "Add parent",
"loading_members": "Loading members..."
"loading_members": "Loading members...",

"project_cycles": {
"status": {
"days_left": "Days left",
"completed": "Completed",
"yet_to_start": "Yet to start",
"in_progress": "In progress",
"draft": "Draft"
}
}
}
12 changes: 11 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,15 @@
"remove_parent_issue": "Eliminar problema padre",
"add_parent": "Agregar padre",
"loading_members": "Cargando miembros...",
"inbox": "bandeja de entrada"
"inbox": "bandeja de entrada",

"project_cycles": {
"status": {
"days_left": "Días restantes",
"completed": "Completado",
"yet_to_start": "Por comenzar",
"in_progress": "En progreso",
"draft": "Borrador"
}
}
}
11 changes: 10 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,14 @@
"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",
"project_cycles": {
"status": {
"days_left": "Jours restants",
"completed": "Terminé",
"yet_to_start": "À démarrer",
"in_progress": "En cours",
"draft": "Brouillon"
}
}
}
12 changes: 11 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,15 @@
"remove_parent_issue": "親問題を削除",
"add_parent": "親問題を追加",
"loading_members": "メンバーを読み込んでいます...",
"inbox": "受信箱"
"inbox": "受信箱",

"project_cycles": {
"status": {
"days_left": "残り日数",
"completed": "完了",
"yet_to_start": "未着手",
"in_progress": "進行中",
"draft": "下書き"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { observer } from "mobx-react";
import { Controller, useForm } from "react-hook-form";
import { ArchiveIcon, ArchiveRestoreIcon, ChevronRight, EllipsisIcon, LinkIcon, Trash2 } from "lucide-react";
// types
import { CYCLE_STATUS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { ICycle } from "@plane/types";
// ui
import { CustomMenu, setToast, TOAST_TYPE } from "@plane/ui";
// components
import { DateRangeDropdown } from "@/components/dropdowns";
// constants
import { CYCLE_STATUS } from "@/constants/cycle";
import { CYCLE_UPDATED } from "@/constants/event-tracker";
// helpers
import { renderFormattedPayloadDate, getDate } from "@/helpers/date-time.helper";
Expand Down Expand Up @@ -53,6 +54,7 @@ export const CycleSidebarHeader: FC<Props> = observer((props) => {
const { allowPermissions } = useUserPermissions();
const { updateCycleDetails, restoreCycle } = useCycle();
const { setTrackElement, captureCycleEvent } = useEventTracker();
const { t } = useTranslation();

// form info
const { control, reset } = useForm({
Expand Down Expand Up @@ -283,7 +285,7 @@ export const CycleSidebarHeader: FC<Props> = observer((props) => {
backgroundColor: `${currentCycle.color}20`,
}}
>
{currentCycle.title}
{t(currentCycle.title)}
</span>
)}
</div>
Expand Down
6 changes: 4 additions & 2 deletions web/core/components/cycles/applied-filters/status.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { observer } from "mobx-react";
import { X } from "lucide-react";
import { CYCLE_STATUS } from "@/constants/cycle";
import { CYCLE_STATUS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { cn } from "@/helpers/common.helper";

type Props = {
Expand All @@ -11,6 +12,7 @@ type Props = {

export const AppliedStatusFilters: React.FC<Props> = observer((props) => {
const { handleRemove, values, editable } = props;
const { t } = useTranslation();

return (
<>
Expand All @@ -25,7 +27,7 @@ export const AppliedStatusFilters: React.FC<Props> = observer((props) => {
statusDetails?.textColor
)}
>
{statusDetails?.title}
{statusDetails && t(statusDetails?.title)}
{editable && (
<button
type="button"
Expand Down
8 changes: 5 additions & 3 deletions web/core/components/cycles/dropdowns/filters/status.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useState } from "react";
import { observer } from "mobx-react";
import { CYCLE_STATUS } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { TCycleGroups } from "@plane/types";
// components
import { FilterHeader, FilterOption } from "@/components/issues";
// types
import { CYCLE_STATUS } from "@/constants/cycle";
// constants

type Props = {
Expand All @@ -17,7 +18,8 @@ export const FilterStatus: React.FC<Props> = observer((props) => {
const { appliedFilters, handleUpdate, searchQuery } = props;
// states
const [previewEnabled, setPreviewEnabled] = useState(true);

//hooks
const { t } = useTranslation();
const appliedFiltersCount = appliedFilters?.length ?? 0;
const filteredOptions = CYCLE_STATUS.filter((p) => p.value.includes(searchQuery.toLowerCase()));

Expand All @@ -36,7 +38,7 @@ export const FilterStatus: React.FC<Props> = observer((props) => {
key={status.value}
isChecked={appliedFilters?.includes(status.value) ? true : false}
onClick={() => handleUpdate(status.value)}
title={status.title}
title={t(status.title)}
/>
))
) : (
Expand Down

0 comments on commit 7bae987

Please sign in to comment.