2026-01-27 08:24:22 +00:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
* See the LICENSE file for details.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-06-25 12:51:30 +00:00
|
|
|
import { useCallback, useMemo } from "react";
|
|
|
|
|
import { observer } from "mobx-react";
|
2025-08-15 07:40:26 +00:00
|
|
|
// plane imports
|
2025-07-17 07:31:24 +00:00
|
|
|
import { ISSUE_LAYOUT_MAP } from "@plane/constants";
|
2025-02-06 15:11:31 +00:00
|
|
|
import { useTranslation } from "@plane/i18n";
|
refactor: migrate web icons to @makeplane/propel (#9731)
* refactor: migrate web icons to @makeplane/propel
Replace confirmed icon symbols across apps/web with their audited
@makeplane/propel/icons targets. Unresolved symbols and the State,
Priority and Brand icons stay on their existing imports.
Lucide size props become explicit width/height, including the two
relation icons and the inbox status icon that forward a size variable.
Two aliased imports resolve to targets the file already imported, so
the aliases are dropped rather than importing the same symbol twice.
Widen the member dropdown chain and the AI menu from LucideIcon to
ComponentType<SVGProps<SVGSVGElement>> so both Lucide and Propel icons
satisfy them; both only ever render the icon with a className.
CycleGroupIcon is deliberately not migrated: it dispatches a different
glyph and color per cycle status, which CyclesOutline cannot express.
apps/web already declared @makeplane/propel, so no dependency change
was needed.
* fix: address icon migration review on web
Restore the six user-facing strings the identifier rename overwrote.
The migration replaced every occurrence of a source symbol name,
including ones inside string literals and JSX text, so the GitHub
empty state read "StarOutline us on GitHub", the exporter column key,
header and button label became "DownloadOutline", the project card
action title became "SettingsOutline" and a tooltip became "PinOutline".
Drop 122 strokeWidth props and 10 text-2 classes. Propel glyphs paint
with fill="currentColor", so strokeWidth never changed weight, and
text-2 was a bad conversion of stroke-2, which is a stroke width rather
than a colour and has no meaning on a fill path.
Use StarFilled for the two favorited sidebar stars. Lucide's Star with
fill-yellow-500 was a solid star, and StarOutline is a ring path, so
filling it does not reproduce that shape.
2026-09-02 15:06:43 +00:00
|
|
|
import { TickOutline } from "@makeplane/propel/icons";
|
2025-08-15 07:40:26 +00:00
|
|
|
import { EIssueLayoutTypes } from "@plane/types";
|
2026-08-04 14:20:50 +00:00
|
|
|
import { getButtonStyling } from "@plane/propel/button";
|
2024-06-25 12:51:30 +00:00
|
|
|
import { Dropdown } from "@plane/ui";
|
2024-12-18 06:52:14 +00:00
|
|
|
import { cn } from "@plane/utils";
|
2025-02-06 15:11:31 +00:00
|
|
|
// components
|
2025-08-15 07:40:26 +00:00
|
|
|
import { IssueLayoutIcon } from "@/components/issues/issue-layouts/layout-icon";
|
2024-06-25 12:51:30 +00:00
|
|
|
|
|
|
|
|
type TLayoutDropDown = {
|
|
|
|
|
onChange: (value: EIssueLayoutTypes) => void;
|
|
|
|
|
value: EIssueLayoutTypes;
|
2024-12-12 16:10:57 +00:00
|
|
|
disabledLayouts?: EIssueLayoutTypes[];
|
2024-06-25 12:51:30 +00:00
|
|
|
};
|
|
|
|
|
|
2025-11-20 12:09:40 +00:00
|
|
|
export const LayoutDropDown = observer(function LayoutDropDown(props: TLayoutDropDown) {
|
2024-12-12 16:10:57 +00:00
|
|
|
const { onChange, value = EIssueLayoutTypes.LIST, disabledLayouts = [] } = props;
|
2025-02-06 15:11:31 +00:00
|
|
|
// plane i18n
|
|
|
|
|
const { t } = useTranslation();
|
2024-12-12 16:10:57 +00:00
|
|
|
// derived values
|
|
|
|
|
const availableLayouts = useMemo(
|
|
|
|
|
() => Object.values(ISSUE_LAYOUT_MAP).filter((layout) => !disabledLayouts.includes(layout.key)),
|
|
|
|
|
[disabledLayouts]
|
|
|
|
|
);
|
2024-06-25 12:51:30 +00:00
|
|
|
|
|
|
|
|
const options = useMemo(
|
|
|
|
|
() =>
|
2024-12-12 16:10:57 +00:00
|
|
|
availableLayouts.map((issueLayout) => ({
|
2024-06-25 12:51:30 +00:00
|
|
|
data: issueLayout.key,
|
|
|
|
|
value: issueLayout.key,
|
|
|
|
|
})),
|
2024-12-12 16:10:57 +00:00
|
|
|
[availableLayouts]
|
2024-06-25 12:51:30 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const buttonContent = useCallback((isOpen: boolean, buttonValue: string | string[] | undefined) => {
|
|
|
|
|
const dropdownValue = ISSUE_LAYOUT_MAP[buttonValue as EIssueLayoutTypes];
|
|
|
|
|
return (
|
2026-03-02 15:10:50 +00:00
|
|
|
<div className="flex items-center gap-2 text-secondary">
|
2025-12-12 15:20:14 +00:00
|
|
|
<IssueLayoutIcon layout={dropdownValue.key} strokeWidth={2} className={`size-3.5 text-secondary`} />
|
2026-03-02 15:10:50 +00:00
|
|
|
<span className="text-11 font-medium">{t(dropdownValue.i18n_label)}</span>
|
2024-06-25 12:51:30 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const itemContent = useCallback((props: { value: string; selected: boolean }) => {
|
|
|
|
|
const dropdownValue = ISSUE_LAYOUT_MAP[props.value as EIssueLayoutTypes];
|
|
|
|
|
|
|
|
|
|
return (
|
2026-03-02 15:10:50 +00:00
|
|
|
<div className={cn("flex w-full items-center justify-between gap-2 text-secondary")}>
|
|
|
|
|
<div className="flex items-center gap-2">
|
2025-12-12 15:20:14 +00:00
|
|
|
<IssueLayoutIcon layout={dropdownValue.key} strokeWidth={2} className={`size-3 text-secondary`} />
|
2026-03-02 15:10:50 +00:00
|
|
|
<span className="text-11 font-medium">{t(dropdownValue.i18n_label)}</span>
|
2024-06-25 12:51:30 +00:00
|
|
|
</div>
|
refactor: migrate web icons to @makeplane/propel (#9731)
* refactor: migrate web icons to @makeplane/propel
Replace confirmed icon symbols across apps/web with their audited
@makeplane/propel/icons targets. Unresolved symbols and the State,
Priority and Brand icons stay on their existing imports.
Lucide size props become explicit width/height, including the two
relation icons and the inbox status icon that forward a size variable.
Two aliased imports resolve to targets the file already imported, so
the aliases are dropped rather than importing the same symbol twice.
Widen the member dropdown chain and the AI menu from LucideIcon to
ComponentType<SVGProps<SVGSVGElement>> so both Lucide and Propel icons
satisfy them; both only ever render the icon with a className.
CycleGroupIcon is deliberately not migrated: it dispatches a different
glyph and color per cycle status, which CyclesOutline cannot express.
apps/web already declared @makeplane/propel, so no dependency change
was needed.
* fix: address icon migration review on web
Restore the six user-facing strings the identifier rename overwrote.
The migration replaced every occurrence of a source symbol name,
including ones inside string literals and JSX text, so the GitHub
empty state read "StarOutline us on GitHub", the exporter column key,
header and button label became "DownloadOutline", the project card
action title became "SettingsOutline" and a tooltip became "PinOutline".
Drop 122 strokeWidth props and 10 text-2 classes. Propel glyphs paint
with fill="currentColor", so strokeWidth never changed weight, and
text-2 was a bad conversion of stroke-2, which is a stroke width rather
than a colour and has no meaning on a fill path.
Use StarFilled for the two favorited sidebar stars. Lucide's Star with
fill-yellow-500 was a solid star, and StarOutline is a ring path, so
filling it does not reproduce that shape.
2026-09-02 15:06:43 +00:00
|
|
|
{props.selected && <TickOutline className="h-3.5 w-3.5 flex-shrink-0" />}
|
2024-06-25 12:51:30 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const keyExtractor = useCallback((option: any) => option.value, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Dropdown
|
|
|
|
|
onChange={onChange as (value: string) => void}
|
|
|
|
|
value={value?.toString()}
|
|
|
|
|
keyExtractor={keyExtractor}
|
|
|
|
|
options={options}
|
2026-08-04 14:20:50 +00:00
|
|
|
buttonContainerClassName={cn(getButtonStyling("secondary", "lg"))}
|
2024-06-25 12:51:30 +00:00
|
|
|
buttonContent={buttonContent}
|
|
|
|
|
renderItem={itemContent}
|
|
|
|
|
disableSearch
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
});
|