diff --git a/space/core/constants/common.ts b/packages/constants/src/file.ts similarity index 100% rename from space/core/constants/common.ts rename to packages/constants/src/file.ts diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index 6d9d5ff9232..09131978691 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -1,8 +1,10 @@ export * from "./auth"; export * from "./endpoints"; +export * from "./file"; export * from "./instance"; export * from "./issue"; export * from "./metadata"; +export * from "./state"; export * from "./swr"; export * from "./user"; export * from "./workspace"; diff --git a/packages/constants/src/issue.ts b/packages/constants/src/issue.ts index ea3cd65d464..19cfe60f3a6 100644 --- a/packages/constants/src/issue.ts +++ b/packages/constants/src/issue.ts @@ -1,5 +1,25 @@ +import { List, Kanban } from "lucide-react"; + export const ALL_ISSUES = "All Issues"; +export type TIssuePriorities = "urgent" | "high" | "medium" | "low" | "none"; + +export type TIssueFilterKeys = "priority" | "state" | "labels"; + +export type TIssueLayout = + | "list" + | "kanban" + | "calendar" + | "spreadsheet" + | "gantt"; + +export type TIssueFilterPriorityObject = { + key: TIssuePriorities; + title: string; + className: string; + icon: string; +}; + export enum EIssueGroupByToServerOptions { "state" = "state_id", "priority" = "priority", @@ -87,3 +107,79 @@ export enum EIssueListRow { NO_ISSUES = "NO_ISSUES", QUICK_ADD = "QUICK_ADD", } + +export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { + [key in TIssueLayout]: Record<"filters", TIssueFilterKeys[]>; +} = { + list: { + filters: ["priority", "state", "labels"], + }, + kanban: { + filters: ["priority", "state", "labels"], + }, + calendar: { + filters: ["priority", "state", "labels"], + }, + spreadsheet: { + filters: ["priority", "state", "labels"], + }, + gantt: { + filters: ["priority", "state", "labels"], + }, +}; + +export const ISSUE_PRIORITIES: { + key: TIssuePriorities; + title: string; +}[] = [ + { key: "urgent", title: "Urgent" }, + { key: "high", title: "High" }, + { key: "medium", title: "Medium" }, + { key: "low", title: "Low" }, + { key: "none", title: "None" }, +]; + +export const ISSUE_PRIORITY_FILTERS: TIssueFilterPriorityObject[] = [ + { + key: "urgent", + title: "Urgent", + className: "bg-red-500 border-red-500 text-white", + icon: "error", + }, + { + key: "high", + title: "High", + className: "text-orange-500 border-custom-border-300", + icon: "signal_cellular_alt", + }, + { + key: "medium", + title: "Medium", + className: "text-yellow-500 border-custom-border-300", + icon: "signal_cellular_alt_2_bar", + }, + { + key: "low", + title: "Low", + className: "text-green-500 border-custom-border-300", + icon: "signal_cellular_alt_1_bar", + }, + { + key: "none", + title: "None", + className: "text-gray-500 border-custom-border-300", + icon: "block", + }, +]; + +export const SITES_ISSUE_LAYOUTS: { + key: TIssueLayout; + title: string; + icon: any; +}[] = [ + { key: "list", title: "List", icon: List }, + { key: "kanban", title: "Kanban", icon: Kanban }, + // { key: "calendar", title: "Calendar", icon: Calendar }, + // { key: "spreadsheet", title: "Spreadsheet", icon: Sheet }, + // { key: "gantt", title: "Gantt chart", icon: GanttChartSquare }, +]; diff --git a/packages/constants/src/metadata.ts b/packages/constants/src/metadata.ts index 0546c25f209..b3563882678 100644 --- a/packages/constants/src/metadata.ts +++ b/packages/constants/src/metadata.ts @@ -9,3 +9,15 @@ export const SITE_KEYWORDS = export const SITE_URL = "https://app.plane.so/"; export const TWITTER_USER_NAME = "Plane | Simple, extensible, open-source project management tool."; + +// Plane Sites Metadata +export const SPACE_SITE_NAME = + "Plane Publish | Make your Plane boards and roadmaps pubic with just one-click. "; +export const SPACE_SITE_TITLE = + "Plane Publish | Make your Plane boards public with one-click"; +export const SPACE_SITE_DESCRIPTION = + "Plane Publish is a customer feedback management tool built on top of plane.so"; +export const SPACE_SITE_KEYWORDS = + "software development, customer feedback, software, accelerate, code management, release management, project management, issue tracking, agile, scrum, kanban, collaboration"; +export const SPACE_SITE_URL = "https://app.plane.so/"; +export const SPACE_TWITTER_USER_NAME = "planepowers"; diff --git a/space/core/constants/state.ts b/packages/constants/src/state.ts similarity index 72% rename from space/core/constants/state.ts rename to packages/constants/src/state.ts index b0fd622be06..c51728bf9ae 100644 --- a/space/core/constants/state.ts +++ b/packages/constants/src/state.ts @@ -1,4 +1,9 @@ -import { TStateGroups } from "@plane/types"; +export type TStateGroups = + | "backlog" + | "unstarted" + | "started" + | "completed" + | "cancelled"; export const STATE_GROUPS: { [key in TStateGroups]: { @@ -34,4 +39,7 @@ export const STATE_GROUPS: { }, }; -export const ARCHIVABLE_STATE_GROUPS = [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key]; +export const ARCHIVABLE_STATE_GROUPS = [ + STATE_GROUPS.completed.key, + STATE_GROUPS.cancelled.key, +]; diff --git a/packages/editor/src/core/constants/common.ts b/packages/editor/src/core/constants/common.ts index 7f4f7f66f37..8961bcd915b 100644 --- a/packages/editor/src/core/constants/common.ts +++ b/packages/editor/src/core/constants/common.ts @@ -1,3 +1,185 @@ +import { + AlignCenter, + AlignLeft, + AlignRight, + Bold, + CaseSensitive, + Code2, + Heading1, + Heading2, + Heading3, + Heading4, + Heading5, + Heading6, + Image, + Italic, + List, + ListOrdered, + ListTodo, + LucideIcon, + Strikethrough, + Table, + TextQuote, + Underline, +} from "lucide-react"; +import { TCommandExtraProps, TEditorCommands } from "@/types/editor"; + +export type TEditorTypes = "lite" | "document"; + +// Utility type to enforce the necessary extra props or make extraProps optional +export type ExtraPropsForCommand = T extends keyof TCommandExtraProps + ? TCommandExtraProps[T] + : object; // Default to empty object for commands without extra props + +export type ToolbarMenuItem = { + itemKey: T; + renderKey: string; + name: string; + icon: LucideIcon; + shortcut?: string[]; + editors: TEditorTypes[]; + extraProps?: ExtraPropsForCommand; +}; + +export const TYPOGRAPHY_ITEMS: ToolbarMenuItem<"text" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6">[] = [ + { itemKey: "text", renderKey: "text", name: "Text", icon: CaseSensitive, editors: ["document"] }, + { itemKey: "h1", renderKey: "h1", name: "Heading 1", icon: Heading1, editors: ["document"] }, + { itemKey: "h2", renderKey: "h2", name: "Heading 2", icon: Heading2, editors: ["document"] }, + { itemKey: "h3", renderKey: "h3", name: "Heading 3", icon: Heading3, editors: ["document"] }, + { itemKey: "h4", renderKey: "h4", name: "Heading 4", icon: Heading4, editors: ["document"] }, + { itemKey: "h5", renderKey: "h5", name: "Heading 5", icon: Heading5, editors: ["document"] }, + { itemKey: "h6", renderKey: "h6", name: "Heading 6", icon: Heading6, editors: ["document"] }, +]; + +export const TEXT_ALIGNMENT_ITEMS: ToolbarMenuItem<"text-align">[] = [ + { + itemKey: "text-align", + renderKey: "text-align-left", + name: "Left align", + icon: AlignLeft, + shortcut: ["Cmd", "Shift", "L"], + editors: ["lite", "document"], + extraProps: { + alignment: "left", + }, + }, + { + itemKey: "text-align", + renderKey: "text-align-center", + name: "Center align", + icon: AlignCenter, + shortcut: ["Cmd", "Shift", "E"], + editors: ["lite", "document"], + extraProps: { + alignment: "center", + }, + }, + { + itemKey: "text-align", + renderKey: "text-align-right", + name: "Right align", + icon: AlignRight, + shortcut: ["Cmd", "Shift", "R"], + editors: ["lite", "document"], + extraProps: { + alignment: "right", + }, + }, +]; + +const BASIC_MARK_ITEMS: ToolbarMenuItem<"bold" | "italic" | "underline" | "strikethrough">[] = [ + { + itemKey: "bold", + renderKey: "bold", + name: "Bold", + icon: Bold, + shortcut: ["Cmd", "B"], + editors: ["lite", "document"], + }, + { + itemKey: "italic", + renderKey: "italic", + name: "Italic", + icon: Italic, + shortcut: ["Cmd", "I"], + editors: ["lite", "document"], + }, + { + itemKey: "underline", + renderKey: "underline", + name: "Underline", + icon: Underline, + shortcut: ["Cmd", "U"], + editors: ["lite", "document"], + }, + { + itemKey: "strikethrough", + renderKey: "strikethrough", + name: "Strikethrough", + icon: Strikethrough, + shortcut: ["Cmd", "Shift", "S"], + editors: ["lite", "document"], + }, +]; + +const LIST_ITEMS: ToolbarMenuItem<"bulleted-list" | "numbered-list" | "to-do-list">[] = [ + { + itemKey: "bulleted-list", + renderKey: "bulleted-list", + name: "Bulleted list", + icon: List, + shortcut: ["Cmd", "Shift", "7"], + editors: ["lite", "document"], + }, + { + itemKey: "numbered-list", + renderKey: "numbered-list", + name: "Numbered list", + icon: ListOrdered, + shortcut: ["Cmd", "Shift", "8"], + editors: ["lite", "document"], + }, + { + itemKey: "to-do-list", + renderKey: "to-do-list", + name: "To-do list", + icon: ListTodo, + shortcut: ["Cmd", "Shift", "9"], + editors: ["lite", "document"], + }, +]; + +export const USER_ACTION_ITEMS: ToolbarMenuItem<"quote" | "code">[] = [ + { itemKey: "quote", renderKey: "quote", name: "Quote", icon: TextQuote, editors: ["lite", "document"] }, + { itemKey: "code", renderKey: "code", name: "Code", icon: Code2, editors: ["lite", "document"] }, +]; + +export const COMPLEX_ITEMS: ToolbarMenuItem<"table" | "image">[] = [ + { itemKey: "table", renderKey: "table", name: "Table", icon: Table, editors: ["document"] }, + { itemKey: "image", renderKey: "image", name: "Image", icon: Image, editors: ["lite", "document"] }, +]; + +export const TOOLBAR_ITEMS: { + [editorType in TEditorTypes]: { + [key: string]: ToolbarMenuItem[]; + }; +} = { + lite: { + basic: BASIC_MARK_ITEMS.filter((item) => item.editors.includes("lite")), + alignment: TEXT_ALIGNMENT_ITEMS.filter((item) => item.editors.includes("lite")), + list: LIST_ITEMS.filter((item) => item.editors.includes("lite")), + userAction: USER_ACTION_ITEMS.filter((item) => item.editors.includes("lite")), + complex: COMPLEX_ITEMS.filter((item) => item.editors.includes("lite")), + }, + document: { + basic: BASIC_MARK_ITEMS.filter((item) => item.editors.includes("document")), + alignment: TEXT_ALIGNMENT_ITEMS.filter((item) => item.editors.includes("document")), + list: LIST_ITEMS.filter((item) => item.editors.includes("document")), + userAction: USER_ACTION_ITEMS.filter((item) => item.editors.includes("document")), + complex: COMPLEX_ITEMS.filter((item) => item.editors.includes("document")), + }, +}; + export const COLORS_LIST: { key: string; label: string; diff --git a/packages/types/src/state.d.ts b/packages/types/src/state.d.ts index 7df658a88b8..120b216da25 100644 --- a/packages/types/src/state.d.ts +++ b/packages/types/src/state.d.ts @@ -1,11 +1,6 @@ import { IProject, IProjectLite, IWorkspaceLite } from "@plane/types"; -export type TStateGroups = - | "backlog" - | "unstarted" - | "started" - | "completed" - | "cancelled"; +export type TStateGroups = "backlog" | "unstarted" | "started" | "completed" | "cancelled"; export interface IState { readonly id: string; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index b897cdfc45f..98399070704 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -3,5 +3,6 @@ export * from "./color"; export * from "./common"; export * from "./emoji"; export * from "./file"; +export * from "./issue"; export * from "./string"; export * from "./theme"; diff --git a/packages/utils/src/issue.ts b/packages/utils/src/issue.ts new file mode 100644 index 00000000000..8bc5165b94f --- /dev/null +++ b/packages/utils/src/issue.ts @@ -0,0 +1,11 @@ +import { ISSUE_PRIORITY_FILTERS, TIssuePriorities, TIssueFilterPriorityObject } from "@plane/constants"; + +export const getIssuePriorityFilters = (priorityKey: TIssuePriorities): TIssueFilterPriorityObject | undefined => { + const currentIssuePriority: TIssueFilterPriorityObject | undefined = + ISSUE_PRIORITY_FILTERS && ISSUE_PRIORITY_FILTERS.length > 0 + ? ISSUE_PRIORITY_FILTERS.find((_priority) => _priority.key === priorityKey) + : undefined; + + if (currentIssuePriority) return currentIssuePriority; + return undefined; +}; diff --git a/space/core/components/editor/toolbar.tsx b/space/core/components/editor/toolbar.tsx index 4593aaf6539..0d6931af553 100644 --- a/space/core/components/editor/toolbar.tsx +++ b/space/core/components/editor/toolbar.tsx @@ -2,11 +2,9 @@ import React, { useEffect, useState, useCallback } from "react"; // editor -import { EditorRefApi } from "@plane/editor"; +import { TOOLBAR_ITEMS, ToolbarMenuItem, EditorRefApi } from "@plane/editor"; // ui import { Button, Tooltip } from "@plane/ui"; -// constants -import { TOOLBAR_ITEMS, ToolbarMenuItem } from "@/constants/editor"; // helpers import { cn } from "@/helpers/common.helper"; diff --git a/space/core/components/issues/filters/priority.tsx b/space/core/components/issues/filters/priority.tsx index 51c1a751990..4f16f89ba83 100644 --- a/space/core/components/issues/filters/priority.tsx +++ b/space/core/components/issues/filters/priority.tsx @@ -3,9 +3,9 @@ import React, { useState } from "react"; import { observer } from "mobx-react"; // ui +import { ISSUE_PRIORITY_FILTERS } from "@plane/constants"; import { PriorityIcon } from "@plane/ui"; // components -import { issuePriorityFilters } from "@/constants/issue"; import { FilterHeader, FilterOption } from "./helpers"; // constants @@ -22,7 +22,7 @@ export const FilterPriority: React.FC = observer((props) => { const appliedFiltersCount = appliedFilters?.length ?? 0; - const filteredOptions = issuePriorityFilters.filter((p) => p.key.includes(searchQuery.toLowerCase())); + const filteredOptions = ISSUE_PRIORITY_FILTERS.filter((p) => p.key.includes(searchQuery.toLowerCase())); return ( <> diff --git a/space/core/components/issues/filters/root.tsx b/space/core/components/issues/filters/root.tsx index 641cf007c0e..ff0a13b8909 100644 --- a/space/core/components/issues/filters/root.tsx +++ b/space/core/components/issues/filters/root.tsx @@ -4,11 +4,11 @@ import { FC, useCallback } from "react"; import cloneDeep from "lodash/cloneDeep"; import { observer } from "mobx-react"; import { useRouter } from "next/navigation"; +// constants +import { ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "@plane/constants"; // components import { FiltersDropdown } from "@/components/issues/filters/helpers/dropdown"; import { FilterSelection } from "@/components/issues/filters/selection"; -// constants -import { ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "@/constants/issue"; // helpers import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks @@ -32,9 +32,9 @@ export const IssueFiltersDropdown: FC = observer((pro const updateRouteParams = useCallback( (key: keyof TIssueQueryFilters, value: string[]) => { - const state = key === "state" ? value : issueFilters?.filters?.state ?? []; - const priority = key === "priority" ? value : issueFilters?.filters?.priority ?? []; - const labels = key === "labels" ? value : issueFilters?.filters?.labels ?? []; + const state = key === "state" ? value : (issueFilters?.filters?.state ?? []); + const priority = key === "priority" ? value : (issueFilters?.filters?.priority ?? []); + const labels = key === "labels" ? value : (issueFilters?.filters?.labels ?? []); const { queryParam } = queryParamGenerator({ board: activeLayout, priority, state, labels }); router.push(`/issues/${anchor}?${queryParam}`); diff --git a/space/core/components/issues/issue-layouts/properties/priority.tsx b/space/core/components/issues/issue-layouts/properties/priority.tsx index efaa8ea36ac..7b4bbda7714 100644 --- a/space/core/components/issues/issue-layouts/properties/priority.tsx +++ b/space/core/components/issues/issue-layouts/properties/priority.tsx @@ -4,7 +4,7 @@ import { TIssuePriorities } from "@plane/types"; import { Tooltip } from "@plane/ui"; // constants -import { issuePriorityFilter } from "@/constants/issue"; +import { getIssuePriorityFilters } from "@plane/utils"; export const IssueBlockPriority = ({ priority, @@ -13,7 +13,7 @@ export const IssueBlockPriority = ({ priority: TIssuePriorities | null; shouldShowName?: boolean; }) => { - const priority_detail = priority != null ? issuePriorityFilter(priority) : null; + const priority_detail = priority != null ? getIssuePriorityFilters(priority) : null; if (priority_detail === null) return <>; diff --git a/space/core/components/issues/issue-layouts/utils.tsx b/space/core/components/issues/issue-layouts/utils.tsx index 992f6367c93..4bd85433ee8 100644 --- a/space/core/components/issues/issue-layouts/utils.tsx +++ b/space/core/components/issues/issue-layouts/utils.tsx @@ -3,6 +3,7 @@ import isNil from "lodash/isNil"; import { ContrastIcon } from "lucide-react"; // types +import { ISSUE_PRIORITIES } from "@plane/constants"; import { GroupByColumnTypes, IGroupByColumn, @@ -14,7 +15,6 @@ import { import { Avatar, CycleGroupIcon, DiceIcon, PriorityIcon, StateGroupIcon } from "@plane/ui"; // components // constants -import { ISSUE_PRIORITIES } from "@/constants/issue"; // stores import { ICycleStore } from "@/store/cycle.store"; import { IIssueLabelStore } from "@/store/label.store"; diff --git a/space/core/components/issues/navbar/layout-selection.tsx b/space/core/components/issues/navbar/layout-selection.tsx index 2d1465c78cb..1b8344d0242 100644 --- a/space/core/components/issues/navbar/layout-selection.tsx +++ b/space/core/components/issues/navbar/layout-selection.tsx @@ -4,9 +4,8 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { useRouter, useSearchParams } from "next/navigation"; // ui +import { SITES_ISSUE_LAYOUTS } from "@plane/constants"; import { Tooltip } from "@plane/ui"; -// constants -import { ISSUE_LAYOUTS } from "@/constants/issue"; // helpers import { queryParamGenerator } from "@/helpers/query-param-generator"; // hooks @@ -42,7 +41,7 @@ export const IssuesLayoutSelection: FC = observer((props) => { return (
- {ISSUE_LAYOUTS.map((layout) => { + {SITES_ISSUE_LAYOUTS.map((layout) => { if (!layoutOptions[layout.key]) return; return ( diff --git a/space/core/components/issues/peek-overview/issue-properties.tsx b/space/core/components/issues/peek-overview/issue-properties.tsx index 0749f8519b4..38dd7ef6f9f 100644 --- a/space/core/components/issues/peek-overview/issue-properties.tsx +++ b/space/core/components/issues/peek-overview/issue-properties.tsx @@ -5,10 +5,9 @@ import { useParams } from "next/navigation"; import { CalendarCheck2, Signal } from "lucide-react"; // ui import { DoubleCircleIcon, StateGroupIcon, TOAST_TYPE, setToast } from "@plane/ui"; +import { getIssuePriorityFilters } from "@plane/utils"; // components import { Icon } from "@/components/ui"; -// constants -import { issuePriorityFilter } from "@/constants/issue"; // helpers import { cn } from "@/helpers/common.helper"; import { renderFormattedDate } from "@/helpers/date-time.helper"; @@ -32,7 +31,7 @@ export const PeekOverviewIssueProperties: React.FC = observer(({ issueDet const { project_details } = usePublish(anchor?.toString()); - const priority = issueDetails.priority ? issuePriorityFilter(issueDetails.priority) : null; + const priority = issueDetails.priority ? getIssuePriorityFilters(issueDetails.priority) : null; const handleCopyLink = () => { const urlToCopy = window.location.href; diff --git a/space/core/constants/editor.ts b/space/core/constants/editor.ts deleted file mode 100644 index 6089c56046c..00000000000 --- a/space/core/constants/editor.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { - AlignCenter, - AlignLeft, - AlignRight, - Bold, - CaseSensitive, - Code2, - Heading1, - Heading2, - Heading3, - Heading4, - Heading5, - Heading6, - Image, - Italic, - List, - ListOrdered, - ListTodo, - LucideIcon, - Strikethrough, - Table, - TextQuote, - Underline, -} from "lucide-react"; -// editor -import { TCommandExtraProps, TEditorCommands } from "@plane/editor"; - -type TEditorTypes = "lite" | "document"; - -// Utility type to enforce the necessary extra props or make extraProps optional -type ExtraPropsForCommand = T extends keyof TCommandExtraProps - ? TCommandExtraProps[T] - : object; // Default to empty object for commands without extra props - -export type ToolbarMenuItem = { - itemKey: T; - renderKey: string; - name: string; - icon: LucideIcon; - shortcut?: string[]; - editors: TEditorTypes[]; - extraProps?: ExtraPropsForCommand; -}; - -export const TYPOGRAPHY_ITEMS: ToolbarMenuItem<"text" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6">[] = [ - { itemKey: "text", renderKey: "text", name: "Text", icon: CaseSensitive, editors: ["document"] }, - { itemKey: "h1", renderKey: "h1", name: "Heading 1", icon: Heading1, editors: ["document"] }, - { itemKey: "h2", renderKey: "h2", name: "Heading 2", icon: Heading2, editors: ["document"] }, - { itemKey: "h3", renderKey: "h3", name: "Heading 3", icon: Heading3, editors: ["document"] }, - { itemKey: "h4", renderKey: "h4", name: "Heading 4", icon: Heading4, editors: ["document"] }, - { itemKey: "h5", renderKey: "h5", name: "Heading 5", icon: Heading5, editors: ["document"] }, - { itemKey: "h6", renderKey: "h6", name: "Heading 6", icon: Heading6, editors: ["document"] }, -]; - -export const TEXT_ALIGNMENT_ITEMS: ToolbarMenuItem<"text-align">[] = [ - { - itemKey: "text-align", - renderKey: "text-align-left", - name: "Left align", - icon: AlignLeft, - shortcut: ["Cmd", "Shift", "L"], - editors: ["lite", "document"], - extraProps: { - alignment: "left", - }, - }, - { - itemKey: "text-align", - renderKey: "text-align-center", - name: "Center align", - icon: AlignCenter, - shortcut: ["Cmd", "Shift", "E"], - editors: ["lite", "document"], - extraProps: { - alignment: "center", - }, - }, - { - itemKey: "text-align", - renderKey: "text-align-right", - name: "Right align", - icon: AlignRight, - shortcut: ["Cmd", "Shift", "R"], - editors: ["lite", "document"], - extraProps: { - alignment: "right", - }, - }, -]; - -const BASIC_MARK_ITEMS: ToolbarMenuItem<"bold" | "italic" | "underline" | "strikethrough">[] = [ - { - itemKey: "bold", - renderKey: "bold", - name: "Bold", - icon: Bold, - shortcut: ["Cmd", "B"], - editors: ["lite", "document"], - }, - { - itemKey: "italic", - renderKey: "italic", - name: "Italic", - icon: Italic, - shortcut: ["Cmd", "I"], - editors: ["lite", "document"], - }, - { - itemKey: "underline", - renderKey: "underline", - name: "Underline", - icon: Underline, - shortcut: ["Cmd", "U"], - editors: ["lite", "document"], - }, - { - itemKey: "strikethrough", - renderKey: "strikethrough", - name: "Strikethrough", - icon: Strikethrough, - shortcut: ["Cmd", "Shift", "S"], - editors: ["lite", "document"], - }, -]; - -const LIST_ITEMS: ToolbarMenuItem<"bulleted-list" | "numbered-list" | "to-do-list">[] = [ - { - itemKey: "bulleted-list", - renderKey: "bulleted-list", - name: "Bulleted list", - icon: List, - shortcut: ["Cmd", "Shift", "7"], - editors: ["lite", "document"], - }, - { - itemKey: "numbered-list", - renderKey: "numbered-list", - name: "Numbered list", - icon: ListOrdered, - shortcut: ["Cmd", "Shift", "8"], - editors: ["lite", "document"], - }, - { - itemKey: "to-do-list", - renderKey: "to-do-list", - name: "To-do list", - icon: ListTodo, - shortcut: ["Cmd", "Shift", "9"], - editors: ["lite", "document"], - }, -]; - -export const USER_ACTION_ITEMS: ToolbarMenuItem<"quote" | "code">[] = [ - { itemKey: "quote", renderKey: "quote", name: "Quote", icon: TextQuote, editors: ["lite", "document"] }, - { itemKey: "code", renderKey: "code", name: "Code", icon: Code2, editors: ["lite", "document"] }, -]; - -export const COMPLEX_ITEMS: ToolbarMenuItem<"table" | "image">[] = [ - { itemKey: "table", renderKey: "table", name: "Table", icon: Table, editors: ["document"] }, - { itemKey: "image", renderKey: "image", name: "Image", icon: Image, editors: ["lite", "document"] }, -]; - -export const TOOLBAR_ITEMS: { - [editorType in TEditorTypes]: { - [key: string]: ToolbarMenuItem[]; - }; -} = { - lite: { - basic: BASIC_MARK_ITEMS.filter((item) => item.editors.includes("lite")), - alignment: TEXT_ALIGNMENT_ITEMS.filter((item) => item.editors.includes("lite")), - list: LIST_ITEMS.filter((item) => item.editors.includes("lite")), - userAction: USER_ACTION_ITEMS.filter((item) => item.editors.includes("lite")), - complex: COMPLEX_ITEMS.filter((item) => item.editors.includes("lite")), - }, - document: { - basic: BASIC_MARK_ITEMS.filter((item) => item.editors.includes("document")), - alignment: TEXT_ALIGNMENT_ITEMS.filter((item) => item.editors.includes("document")), - list: LIST_ITEMS.filter((item) => item.editors.includes("document")), - userAction: USER_ACTION_ITEMS.filter((item) => item.editors.includes("document")), - complex: COMPLEX_ITEMS.filter((item) => item.editors.includes("document")), - }, -}; diff --git a/space/core/constants/issue.ts b/space/core/constants/issue.ts deleted file mode 100644 index 1d9ebbb19c6..00000000000 --- a/space/core/constants/issue.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Kanban, List } from "lucide-react"; -// types -import { TIssuePriorities } from "@plane/types"; -import { TIssueLayout, TIssueFilterKeys, TIssueFilterPriorityObject } from "@/types/issue"; - -// issue filters -export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { [key in TIssueLayout]: Record<"filters", TIssueFilterKeys[]> } = { - list: { - filters: ["priority", "state", "labels"], - }, - kanban: { - filters: ["priority", "state", "labels"], - }, - calendar: { - filters: ["priority", "state", "labels"], - }, - spreadsheet: { - filters: ["priority", "state", "labels"], - }, - gantt: { - filters: ["priority", "state", "labels"], - }, -}; - -export const ISSUE_LAYOUTS: { - key: TIssueLayout; - title: string; - icon: any; -}[] = [ - { key: "list", title: "List", icon: List }, - { key: "kanban", title: "Kanban", icon: Kanban }, - // { key: "calendar", title: "Calendar", icon: Calendar }, - // { key: "spreadsheet", title: "Spreadsheet", icon: Sheet }, - // { key: "gantt", title: "Gantt chart", icon: GanttChartSquare }, -]; - -export const issuePriorityFilters: TIssueFilterPriorityObject[] = [ - { - key: "urgent", - title: "Urgent", - className: "bg-red-500 border-red-500 text-white", - icon: "error", - }, - { - key: "high", - title: "High", - className: "text-orange-500 border-custom-border-300", - icon: "signal_cellular_alt", - }, - { - key: "medium", - title: "Medium", - className: "text-yellow-500 border-custom-border-300", - icon: "signal_cellular_alt_2_bar", - }, - { - key: "low", - title: "Low", - className: "text-green-500 border-custom-border-300", - icon: "signal_cellular_alt_1_bar", - }, - { - key: "none", - title: "None", - className: "text-gray-500 border-custom-border-300", - icon: "block", - }, -]; - -export const issuePriorityFilter = (priorityKey: TIssuePriorities): TIssueFilterPriorityObject | undefined => { - const currentIssuePriority: TIssueFilterPriorityObject | undefined = - issuePriorityFilters && issuePriorityFilters.length > 0 - ? issuePriorityFilters.find((_priority) => _priority.key === priorityKey) - : undefined; - - if (currentIssuePriority) return currentIssuePriority; - return undefined; -}; - -export const ISSUE_PRIORITIES: { - key: TIssuePriorities; - title: string; -}[] = [ - { key: "urgent", title: "Urgent" }, - { key: "high", title: "High" }, - { key: "medium", title: "Medium" }, - { key: "low", title: "Low" }, - { key: "none", title: "None" }, -]; \ No newline at end of file diff --git a/space/core/constants/seo.ts b/space/core/constants/seo.ts deleted file mode 100644 index f681ab8b25d..00000000000 --- a/space/core/constants/seo.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const SITE_NAME = "Plane Publish | Make your Plane boards and roadmaps pubic with just one-click. "; -export const SITE_TITLE = "Plane Publish | Make your Plane boards public with one-click"; -export const SITE_DESCRIPTION = "Plane Publish is a customer feedback management tool built on top of plane.so"; -export const SITE_KEYWORDS = - "software development, customer feedback, software, accelerate, code management, release management, project management, issue tracking, agile, scrum, kanban, collaboration"; -export const SITE_URL = "https://app.plane.so/"; -export const TWITTER_USER_NAME = "planepowers"; diff --git a/space/core/store/issue-filters.store.ts b/space/core/store/issue-filters.store.ts index 0c589dc4d3b..be9ca438b2c 100644 --- a/space/core/store/issue-filters.store.ts +++ b/space/core/store/issue-filters.store.ts @@ -3,10 +3,9 @@ import isEqual from "lodash/isEqual"; import set from "lodash/set"; import { action, makeObservable, observable, runInAction } from "mobx"; import { computedFn } from "mobx-utils"; -// plane types +// plane internal +import { ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "@plane/constants"; import { IssuePaginationOptions, TIssueParams } from "@plane/types"; -// constants -import { ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "@/constants/issue"; // store import { CoreRootStore } from "@/store/root.store"; // types @@ -75,14 +74,12 @@ export class IssueFilterStore implements IIssueFilterStore { Object.keys(filters).map((key) => { const currentFilterKey = key as TIssueFilterKeys; + const filterValue = filters[currentFilterKey] as any; - if (filters[currentFilterKey] != undefined && filteredParams.includes(currentFilterKey)) { - if (Array.isArray(filters[currentFilterKey])) - computedFilters[currentFilterKey] = filters[currentFilterKey]?.join(","); - else if (filters[currentFilterKey] && typeof filters[currentFilterKey] === "string") - computedFilters[currentFilterKey] = filters[currentFilterKey]?.toString(); - else if (typeof filters[currentFilterKey] === "boolean") - computedFilters[currentFilterKey] = filters[currentFilterKey]?.toString(); + if (filterValue !== undefined && filteredParams.includes(currentFilterKey)) { + if (Array.isArray(filterValue)) computedFilters[currentFilterKey] = filterValue.join(","); + else if (typeof filterValue === "string" || typeof filterValue === "boolean") + computedFilters[currentFilterKey] = filterValue.toString(); } }); diff --git a/space/helpers/editor.helper.ts b/space/helpers/editor.helper.ts index b037055afeb..15891cfb1b8 100644 --- a/space/helpers/editor.helper.ts +++ b/space/helpers/editor.helper.ts @@ -1,7 +1,7 @@ -// plane editor +// plane internal +import { MAX_FILE_SIZE } from "@plane/constants"; import { TFileHandler } from "@plane/editor"; -// constants -import { MAX_FILE_SIZE } from "@/constants/common"; + // helpers import { getFileURL } from "@/helpers/file.helper"; // services diff --git a/space/helpers/issue.helper.ts b/space/helpers/issue.helper.ts index a5159edef27..5816b15b445 100644 --- a/space/helpers/issue.helper.ts +++ b/space/helpers/issue.helper.ts @@ -1,8 +1,7 @@ import { differenceInCalendarDays } from "date-fns"; -// types +// plane internal +import { STATE_GROUPS } from "@plane/constants"; import { TStateGroups } from "@plane/types"; -// constants -import { STATE_GROUPS } from "@/constants/state"; // helpers import { getDate } from "@/helpers/date-time.helper"; diff --git a/space/helpers/state.helper.ts b/space/helpers/state.helper.ts index 81bffdef960..8d97c39f617 100644 --- a/space/helpers/state.helper.ts +++ b/space/helpers/state.helper.ts @@ -1,5 +1,5 @@ +import { STATE_GROUPS } from "@plane/constants"; import { IState } from "@plane/types"; -import { STATE_GROUPS } from "@/constants/state"; export const sortStates = (states: IState[]) => { if (!states || states.length === 0) return;