* 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.
151 lines
5.4 KiB
TypeScript
151 lines
5.4 KiB
TypeScript
/**
|
||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||
* SPDX-License-Identifier: AGPL-3.0-only
|
||
* See the LICENSE file for details.
|
||
*/
|
||
|
||
import { useState } from "react";
|
||
import { observer } from "mobx-react";
|
||
import { useParams } from "next/navigation";
|
||
import {
|
||
CloseOutline,
|
||
CyclesOutline,
|
||
SearchOutline,
|
||
TransferWorkItemOutline,
|
||
WarningCircleOutline,
|
||
} from "@makeplane/propel/icons";
|
||
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
|
||
import { EIssuesStoreType } from "@plane/types";
|
||
import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui";
|
||
import { useCycle } from "@/hooks/store/use-cycle";
|
||
import { useIssues } from "@/hooks/store/use-issues";
|
||
|
||
type Props = {
|
||
isOpen: boolean;
|
||
handleClose: () => void;
|
||
cycleId: string;
|
||
};
|
||
|
||
export const TransferIssuesModal = observer(function TransferIssuesModal(props: Props) {
|
||
const { isOpen, handleClose, cycleId } = props;
|
||
// states
|
||
const [query, setQuery] = useState("");
|
||
|
||
// store hooks
|
||
const { currentProjectIncompleteCycleIds, getCycleById, fetchActiveCycleProgress } = useCycle();
|
||
const {
|
||
issues: { transferIssuesFromCycle },
|
||
} = useIssues(EIssuesStoreType.CYCLE);
|
||
|
||
const { workspaceSlug, projectId } = useParams();
|
||
|
||
const transferIssue = async (payload: { new_cycle_id: string }) => {
|
||
if (!workspaceSlug || !projectId || !cycleId) return;
|
||
|
||
await transferIssuesFromCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), payload)
|
||
.then(async () => {
|
||
setToast({
|
||
type: TOAST_TYPE.SUCCESS,
|
||
title: "Success!",
|
||
message: "Work items have been transferred successfully",
|
||
});
|
||
await getCycleDetails(payload.new_cycle_id);
|
||
})
|
||
.catch(() => {
|
||
setToast({
|
||
type: TOAST_TYPE.ERROR,
|
||
title: "Error!",
|
||
message: "Unable to transfer work items. Please try again.",
|
||
});
|
||
});
|
||
};
|
||
|
||
/**To update issue counts in target cycle and current cycle */
|
||
const getCycleDetails = async (newCycleId: string) => {
|
||
const cyclesFetch = [
|
||
fetchActiveCycleProgress(workspaceSlug.toString(), projectId.toString(), cycleId),
|
||
fetchActiveCycleProgress(workspaceSlug.toString(), projectId.toString(), newCycleId),
|
||
];
|
||
await Promise.all(cyclesFetch).catch((error) => {
|
||
setToast({
|
||
type: TOAST_TYPE.ERROR,
|
||
title: "Error",
|
||
message: error.error || "Unable to fetch cycle details",
|
||
});
|
||
});
|
||
};
|
||
|
||
const filteredOptions = currentProjectIncompleteCycleIds?.filter((optionId) => {
|
||
const cycleDetails = getCycleById(optionId);
|
||
|
||
return cycleDetails?.name?.toLowerCase().includes(query?.toLowerCase());
|
||
});
|
||
|
||
return (
|
||
<ModalCore isOpen={isOpen} handleClose={handleClose} position={EModalPosition.TOP} width={EModalWidth.XXL}>
|
||
<div className="flex flex-col gap-4 py-5">
|
||
<div className="flex items-center justify-between px-5">
|
||
<div className="flex items-center gap-1">
|
||
<TransferWorkItemOutline className="w-5 fill-primary" />
|
||
<h4 className="text-18 font-medium text-primary">Transfer work items</h4>
|
||
</div>
|
||
<button onClick={handleClose}>
|
||
<CloseOutline className="h-4 w-4" />
|
||
</button>
|
||
</div>
|
||
<div className="flex items-center gap-2 border-b border-subtle px-5 pb-3">
|
||
<SearchOutline className="h-4 w-4 text-secondary" />
|
||
<input
|
||
className="text-13 outline-none"
|
||
placeholder="Search for a cycle..."
|
||
onChange={(e) => setQuery(e.target.value)}
|
||
value={query}
|
||
/>
|
||
</div>
|
||
<div className="flex w-full flex-col items-start gap-2 px-5">
|
||
{filteredOptions ? (
|
||
filteredOptions.length > 0 ? (
|
||
filteredOptions.map((optionId) => {
|
||
const cycleDetails = getCycleById(optionId);
|
||
|
||
if (!cycleDetails) return;
|
||
|
||
return (
|
||
<button
|
||
key={optionId}
|
||
className="flex w-full items-center gap-4 rounded-sm px-4 py-3 text-13 text-secondary hover:bg-surface-2"
|
||
onClick={() => {
|
||
transferIssue({
|
||
new_cycle_id: optionId,
|
||
});
|
||
handleClose();
|
||
}}
|
||
>
|
||
<CyclesOutline className="h-5 w-5" />
|
||
<div className="flex w-full justify-between truncate">
|
||
<span className="truncate">{cycleDetails?.name}</span>
|
||
{cycleDetails.status && (
|
||
<span className="flex flex-shrink-0 items-center rounded-full bg-layer-1 px-2 capitalize">
|
||
{cycleDetails.status.toLocaleLowerCase()}
|
||
</span>
|
||
)}
|
||
</div>
|
||
</button>
|
||
);
|
||
})
|
||
) : (
|
||
<div className="flex w-full items-center justify-center gap-4 p-5 text-13">
|
||
<WarningCircleOutline className="h-3.5 w-3.5 text-secondary" />
|
||
<span className="text-center text-secondary">
|
||
You don’t have any current cycle. Please create one to transfer the work items.
|
||
</span>
|
||
</div>
|
||
)
|
||
) : (
|
||
<p className="text-center text-secondary">Loading...</p>
|
||
)}
|
||
</div>
|
||
</div>
|
||
</ModalCore>
|
||
);
|
||
});
|