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

fix: ln support for views constants #6431

Merged
merged 6 commits into from
Jan 27, 2025
Merged
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
1 change: 1 addition & 0 deletions packages/constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from "./tab-indices";
export * from "./user";
export * from "./workspace";
export * from "./stickies";
export * from "./views";
export * from "./inbox";
export * from "./profile";
export * from "./workspace-drafts";
23 changes: 23 additions & 0 deletions packages/constants/src/views.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export enum EViewAccess {
PRIVATE,
PUBLIC,
}

export const VIEW_ACCESS_SPECIFIERS: {
key: EViewAccess;
i18n_label: string;
}[] = [
{ key: EViewAccess.PUBLIC, i18n_label: "project_view.access.public" },
{ key: EViewAccess.PRIVATE, i18n_label: "project_view.access.private" },
];

export const VIEW_SORTING_KEY_OPTIONS = [
{ key: "name", i18n_label: "project_view.sort_by.name" },
{ key: "created_at", i18n_label: "project_view.sort_by.created_at" },
{ key: "updated_at", i18n_label: "project_view.sort_by.updated_at" },
];

export const VIEW_SORT_BY_OPTIONS = [
{ key: "asc", i18n_label: "common.order_by.asc" },
{ key: "desc", i18n_label: "common.order_by.desc" },
];
17 changes: 16 additions & 1 deletion packages/i18n/src/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@
"no_data_yet": "No Data yet",
"connections": "Connections",

"project_view": {
"access": {
"public": "Public",
"private": "Private"
},
"sort_by": {
"created_at": "Created at",
"updated_at": "Updated at",
"name": "Name"
}
},

"toast": {
"success": "Success!",
"error": "Error!"
Expand Down Expand Up @@ -485,7 +497,10 @@
"last_created": "Last created",
"last_updated": "Last updated",
"start_date": "Start date",
"due_date": "Due date"
"due_date": "Due date",

"asc": "Ascending",
"desc": "Descending"
},
"sort": {
"asc": "Ascending",
Expand Down
16 changes: 15 additions & 1 deletion packages/i18n/src/locales/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,18 @@
"no_data_yet": "Sin datos aún",
"connections": "Conexiones",

"project_view": {
"access": {
"public": "Público",
"private": "Privado"
},
"sort_by": {
"created_at": "Fecha de creación",
"updated_at": "Fecha de actualización",
"name": "Nombre"
}
},

"toast": {
"success": "¡Éxito!",
"error": "¡Error!"
Expand Down Expand Up @@ -489,7 +501,9 @@
"last_created": "Último creado",
"last_updated": "Última actualización",
"start_date": "Fecha de inicio",
"due_date": "Fecha de vencimiento"
"due_date": "Fecha de vencimiento",
"asc": "Ascendente",
"desc": "Descendente"
},
"sort": {
"asc": "Ascendente",
Expand Down
16 changes: 15 additions & 1 deletion packages/i18n/src/locales/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,18 @@
"no_data_yet": "Pas encore de données",
"connections": "Connexions",

"project_view": {
"access": {
"public": "Public",
"private": "Privé"
},
"sort_by": {
"created_at": "Date de création",
"updated_at": "Date de modification",
"name": "Nom"
}
},

"toast": {
"success": "Succès !",
"error": "Erreur !"
Expand Down Expand Up @@ -488,7 +500,9 @@
"last_created": "Dernière création",
"last_updated": "Dernière mise à jour",
"start_date": "Date de début",
"due_date": "Date d'échéance"
"due_date": "Date d'échéance",
"asc": "Croissant",
"desc": "Décroissant"
},
"sort": {
"asc": "Croissant",
Expand Down
18 changes: 16 additions & 2 deletions packages/i18n/src/locales/ja/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
"change_parent_issue": "親問題を変更",
"remove_parent_issue": "親問題を削除",
"add_parent": "親問題を追加",
"loading_members": "メンバーを読み込んでいます...",
"loading_members": "メンバーを読み込んでいます...",
"view_link_copied_to_clipboard": "表示リンクがクリップボードにコピーされました。",
"required": "必須",
"optional": "任意",
Expand All @@ -329,6 +329,18 @@
"no_data_yet": "まだデータがありません",
"connections": "接続",

"project_view": {
"access": {
"public": "公開",
"private": "非公開"
},
"sort_by": {
"created_at": "作成日時",
"updated_at": "更新日時",
"name": "名前"
}
},

"toast": {
"success": "成功!",
"error": "エラー!"
Expand Down Expand Up @@ -487,7 +499,9 @@
"last_created": "最後に作成",
"last_updated": "最後に更新",
"start_date": "開始日",
"due_date": "期限日"
"due_date": "期限日",
"asc": "昇順",
"desc": "降順"
},
"sort": {
"asc": "昇順",
Expand Down
16 changes: 15 additions & 1 deletion packages/i18n/src/locales/zh-CN/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@
"show_less": "显示较少",
"no_data_yet": "暂无数据",

"project_view": {
"access": {
"public": "公开",
"private": "私密"
},
"sort_by": {
"created_at": "创建时间",
"updated_at": "更新时间",
"name": "名称"
}
},

"toast": {
"success": "成功!",
"error": "错误!"
Expand Down Expand Up @@ -510,7 +522,9 @@
"last_created": "最近创建",
"last_updated": "最近更新",
"start_date": "开始日期",
"due_date": "截止日期"
"due_date": "截止日期",
"asc": "升序",
"desc": "降序"
},
"sort": {
"asc": "升序",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import Link from "next/link";
import { useParams } from "next/navigation";
import { Layers, Lock } from "lucide-react";
// plane constants
import { EIssueLayoutTypes, EIssueFilterType, EIssuesStoreType, ISSUE_DISPLAY_FILTERS_BY_PAGE } from "@plane/constants";
import {
EIssueLayoutTypes,
EIssueFilterType,
EIssuesStoreType,
ISSUE_DISPLAY_FILTERS_BY_PAGE,
EViewAccess,
} from "@plane/constants";
// types
import { IIssueDisplayFilterOptions, IIssueDisplayProperties, IIssueFilterOptions } from "@plane/types";
// ui
Expand All @@ -16,7 +22,6 @@ import { BreadcrumbLink, Logo } from "@/components/common";
import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelection } from "@/components/issues";
// constants
import { ViewQuickActions } from "@/components/views";
import { EViewAccess } from "@/constants/views";
// helpers
import { isIssueFilterActive } from "@/helpers/filter.helper";
import { truncateText } from "@/helpers/string.helper";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useCallback } from "react";
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
// components
import { EUserPermissionsLevel, EUserProjectRoles } from "@plane/constants";
import { EUserPermissionsLevel, EUserProjectRoles, EViewAccess } from "@plane/constants";
import { useTranslation } from "@plane/i18n";
import { TViewFilterProps } from "@plane/types";
import { Header, EHeaderVariant } from "@plane/ui";
Expand All @@ -13,7 +13,6 @@ import { DetailedEmptyState } from "@/components/empty-state";
import { ProjectViewsList } from "@/components/views";
import { ViewAppliedFiltersList } from "@/components/views/applied-filters";
// constants
import { EViewAccess } from "@/constants/views";
// helpers
import { calculateTotalFilters } from "@/helpers/filter.helper";
// hooks
Expand Down
2 changes: 1 addition & 1 deletion web/ce/services/project/view.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EViewAccess } from "@plane/constants";
import { TPublishViewSettings } from "@plane/types";
import { EViewAccess } from "@/constants/views";
import { API_BASE_URL } from "@/helpers/common.helper";
import { ViewService as CoreViewService } from "@/services/view.service";

Expand Down
2 changes: 1 addition & 1 deletion web/ce/services/workspace.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EViewAccess } from "@/constants/views";
import { EViewAccess } from "@plane/constants";
import { API_BASE_URL } from "@/helpers/common.helper";
import { WorkspaceService as CoreWorkspaceService } from "@/services/workspace.service";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import isEmpty from "lodash/isEmpty";
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
// types
import { DEFAULT_GLOBAL_VIEWS_LIST,EIssueFilterType, EIssuesStoreType } from "@plane/constants";
import { DEFAULT_GLOBAL_VIEWS_LIST, EIssueFilterType, EIssuesStoreType, EViewAccess } from "@plane/constants";
import { IIssueFilterOptions, TStaticViewTypes } from "@plane/types";
//ui
// components
Expand All @@ -16,7 +16,6 @@ import { UpdateViewComponent } from "@/components/views/update-view-component";
import { CreateUpdateWorkspaceViewModal } from "@/components/workspace";
// constants
import { GLOBAL_VIEW_UPDATED } from "@/constants/event-tracker";
import { EViewAccess } from "@/constants/views";
// helpers
import { cn } from "@/helpers/common.helper";
// hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import isEmpty from "lodash/isEmpty";
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
// types
import { EIssueFilterType, EIssuesStoreType } from "@plane/constants";
import { EIssueFilterType, EIssuesStoreType, EViewAccess } from "@plane/constants";
import { IIssueFilterOptions } from "@plane/types";
// components
import { Header, EHeaderVariant } from "@plane/ui";
import { AppliedFiltersList } from "@/components/issues";
import { CreateUpdateProjectViewModal } from "@/components/views";
import { UpdateViewComponent } from "@/components/views/update-view-component";
// constants
import { EViewAccess } from "@/constants/views";
// hooks
import { useIssues, useLabel, useProjectState, useProjectView, useUser, useUserPermissions } from "@/hooks/store";
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
Expand Down
9 changes: 6 additions & 3 deletions web/core/components/views/applied-filters/access.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { observer } from "mobx-react";
// icons
import { X } from "lucide-react";
// constants
import { EViewAccess, VIEW_ACCESS_SPECIFIERS } from "@/constants/views";
import { EViewAccess } from "@plane/constants";
// helpers
import { useTranslation } from "@plane/i18n";
import { VIEW_ACCESS_SPECIFIERS } from "@/helpers/views.helper";

type Props = {
editable: boolean | undefined;
Expand All @@ -13,10 +15,11 @@ type Props = {

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

const getAccessLabel = (val: EViewAccess) => {
const value = VIEW_ACCESS_SPECIFIERS.find((option) => option.key === val);
return value?.label;
return value?.i18n_label;
gakshita marked this conversation as resolved.
Show resolved Hide resolved
};

return (
Expand All @@ -28,7 +31,7 @@ export const AppliedAccessFilters: React.FC<Props> = observer((props) => {

return (
<div key={access} className="flex items-center gap-1 rounded bg-custom-background-80 py-1 px-1.5 text-xs">
<span className="normal-case">{label}</span>
<span className="normal-case">{t(label)}</span>
{editable && (
<button
type="button"
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/views/applied-filters/root.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { X } from "lucide-react";
import { EViewAccess } from "@plane/constants";
import { TViewFilterProps } from "@plane/types";
// components
import { Tag } from "@plane/ui";
import { AppliedDateFilters, AppliedMembersFilters } from "@/components/common/applied-filters";
// constants
import { EViewAccess } from "@/constants/views";
// helpers
import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper";
import { AppliedAccessFilters } from "./access";
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/views/filters/filter-selection.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useState } from "react";
import { observer } from "mobx-react";
import { Search, X } from "lucide-react";
import { EViewAccess } from "@plane/constants";
import { TViewFilterProps, TViewFilters } from "@plane/types";
// components
import { FilterCreatedBy, FilterCreatedDate } from "@/components/common/filters";
import { FilterOption } from "@/components/issues";
// constants
import { EViewAccess } from "@/constants/views";
// hooks
import { usePlatformOS } from "@/hooks/use-platform-os";
// plane web components
Expand Down
Loading
Loading