Files
plane/web/ee/components/active-cycles/header.tsx

79 lines
3.1 KiB
TypeScript
Raw Permalink Normal View History

import { FC } from "react";
import Link from "next/link";
// types
import { ICycle, TCycleGroups } from "@plane/types";
2024-03-20 19:06:20 +05:30
// ui
import { Tooltip, CycleGroupIcon, getButtonStyling, Avatar, AvatarGroup } from "@plane/ui";
// helpers
2024-03-20 19:06:20 +05:30
import { renderFormattedDate, findHowManyDaysLeft } from "@/helpers/date-time.helper";
fix: merge conflicts and build errors (#1469) * dev: private bucket implementation (#1339) * chore: migrations and backmigration to move attachments to file asset * chore: move attachments to file assets * chore: update migration file to include created by and updated by and size * chore: remove uninmport errors * chore: make size as float field * fix: file asset uploads * chore: asset uploads migration changes * chore: v2 assets endpoint * chore: remove unused imports * chore: issue attachments * chore: issue attachments * chore: workspace logo endpoints * chore: private bucket changes * chore: user asset endpoint * chore: add logo_url validation * chore: cover image urlk * chore: change asset max length * chore: pages endpoint * chore: store the storage_metadata only when none * chore: attachment asset apis * chore: update create private bucket * chore: make bucket private * chore: fix response of user uploads * fix: response of user uploads * fix: job to fix file asset uploads * fix: user asset endpoints * chore: avatar for user profile * chore: external apis user url endpoint * chore: upload workspace and user asset actions updated * chore: analytics endpoint * fix: analytics export * chore: avatar urls * chore: update user avatar instances * chore: avatar urls for assignees and creators * chore: bucket permission script * fix: all user avatr instances in the web app * chore: update project cover image logic * fix: issue attachment endpoint * chore: patch endpoint for issue attachment * chore: attachments * chore: change attachment storage class * chore: update issue attachment endpoints * fix: issue attachment * chore: update issue attachment implementation * chore: page asset endpoints * fix: web build errors * chore: attachments * chore: page asset urls * chore: comment and issue asset endpoints * chore: asset endpoints * chore: attachment endpoints * chore: bulk asset endpoint * chore: restore endpoint * chore: project assets endpoints * chore: asset url * chore: add delete asset endpoints * chore: fix asset upload endpoint * chore: update patch endpoints * chore: update patch endpoint * chore: update editor image handling * chore: asset restore endpoints * chore: avatar url for space assets * chore: space app assets migration * fix: space app urls * chore: space endpoints * fix: old editor images rendering logic * fix: issue archive and attachment activity * chore: asset deletes * chore: update images * chore: attachment delete * fix: issue attachment * fix: issue attachment get * chore: cover image url for projects * chore: remove duplicate py file * fix: url check function * chore: chore project cover asset delete * fix: migrations * chore: delete migration files --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> * fix: private bucket build errors (#1347) * fix: private bucket build errors * fix: build errors * revert: issue type select changes. (#1355) * chore: private bucket implementation for workspace level pages (#1371) * chore: update project modal * chore: update rich-text read-only editor * chore: update workspace pages' components * chore: remove entity identifier in favour of multiple columns of entities (#1405) * fix: issue attachments (#1411) * fix: issue attachments (#1422) * chore: file size limit for pro workspaces (#1437) * chore: file size limit for pro * chore: update maximum file size logic * chore: update editor max file size logic * chore: update max file size limit logic * chore: add comments * fix: close modal after removing workspace logo * chore: update uploaded asstes' status post issue creation * chore: memoize max file size var * chore: check for pro file size limits * chore: added file size limit to the space app --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> * chore: add max file size limit to workspace pages (#1440) * fix: remove old workspace logo and user avatar (#1445) * fix: intake exception error (#5810) * chore: filtered active cycles for guest (#1468) * fix: build error --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
2024-10-12 01:47:13 +05:30
import { getFileURL } from "@/helpers/file.helper";
2024-03-20 19:06:20 +05:30
import { truncateText } from "@/helpers/string.helper";
// hooks
import { useMember } from "@/hooks/store";
export type ActiveCycleHeaderProps = {
cycle: ICycle;
workspaceSlug: string;
projectId: string;
};
export const ActiveCycleHeader: FC<ActiveCycleHeaderProps> = (props) => {
const { cycle, workspaceSlug, projectId } = props;
2024-02-01 14:57:40 +05:30
// store
const { getUserDetails } = useMember();
const cycleOwnerDetails = cycle && cycle.owned_by_id ? getUserDetails(cycle.owned_by_id) : undefined;
2024-02-08 14:04:18 +05:30
const daysLeft = findHowManyDaysLeft(cycle.end_date) ?? 0;
2024-04-05 20:18:40 +05:30
const currentCycleStatus = cycle?.status?.toLocaleLowerCase() as TCycleGroups;
const cycleAssignee = (cycle.distribution?.assignees ?? []).filter((assignee) => assignee.display_name);
return (
<div className="flex items-center justify-between px-3 py-1.5 rounded border-[0.5px] border-custom-border-100 bg-custom-background-90">
<div className="flex items-center gap-2 cursor-default">
<CycleGroupIcon cycleGroup={currentCycleStatus} className="h-4 w-4" />
<Tooltip tooltipContent={cycle.name} position="top-left">
<h3 className="break-words text-lg font-medium">{truncateText(cycle.name, 70)}</h3>
</Tooltip>
<Tooltip
tooltipContent={`Start date: ${renderFormattedDate(cycle.start_date ?? "")} Due Date: ${renderFormattedDate(
cycle.end_date ?? ""
)}`}
position="top-left"
>
<span className="flex gap-1 whitespace-nowrap rounded-sm text-custom-text-400 font-semibold text-sm leading-5">
{`${daysLeft} ${daysLeft > 1 ? "days" : "day"} left`}
</span>
</Tooltip>
</div>
<div className="flex items-center gap-4">
<div className="rounded-sm text-sm">
<div className="flex gap-2 divide-x spac divide-x-border-300 text-sm whitespace-nowrap text-custom-text-300 font-medium">
fix: merge conflicts and build errors (#1469) * dev: private bucket implementation (#1339) * chore: migrations and backmigration to move attachments to file asset * chore: move attachments to file assets * chore: update migration file to include created by and updated by and size * chore: remove uninmport errors * chore: make size as float field * fix: file asset uploads * chore: asset uploads migration changes * chore: v2 assets endpoint * chore: remove unused imports * chore: issue attachments * chore: issue attachments * chore: workspace logo endpoints * chore: private bucket changes * chore: user asset endpoint * chore: add logo_url validation * chore: cover image urlk * chore: change asset max length * chore: pages endpoint * chore: store the storage_metadata only when none * chore: attachment asset apis * chore: update create private bucket * chore: make bucket private * chore: fix response of user uploads * fix: response of user uploads * fix: job to fix file asset uploads * fix: user asset endpoints * chore: avatar for user profile * chore: external apis user url endpoint * chore: upload workspace and user asset actions updated * chore: analytics endpoint * fix: analytics export * chore: avatar urls * chore: update user avatar instances * chore: avatar urls for assignees and creators * chore: bucket permission script * fix: all user avatr instances in the web app * chore: update project cover image logic * fix: issue attachment endpoint * chore: patch endpoint for issue attachment * chore: attachments * chore: change attachment storage class * chore: update issue attachment endpoints * fix: issue attachment * chore: update issue attachment implementation * chore: page asset endpoints * fix: web build errors * chore: attachments * chore: page asset urls * chore: comment and issue asset endpoints * chore: asset endpoints * chore: attachment endpoints * chore: bulk asset endpoint * chore: restore endpoint * chore: project assets endpoints * chore: asset url * chore: add delete asset endpoints * chore: fix asset upload endpoint * chore: update patch endpoints * chore: update patch endpoint * chore: update editor image handling * chore: asset restore endpoints * chore: avatar url for space assets * chore: space app assets migration * fix: space app urls * chore: space endpoints * fix: old editor images rendering logic * fix: issue archive and attachment activity * chore: asset deletes * chore: update images * chore: attachment delete * fix: issue attachment * fix: issue attachment get * chore: cover image url for projects * chore: remove duplicate py file * fix: url check function * chore: chore project cover asset delete * fix: migrations * chore: delete migration files --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> * fix: private bucket build errors (#1347) * fix: private bucket build errors * fix: build errors * revert: issue type select changes. (#1355) * chore: private bucket implementation for workspace level pages (#1371) * chore: update project modal * chore: update rich-text read-only editor * chore: update workspace pages' components * chore: remove entity identifier in favour of multiple columns of entities (#1405) * fix: issue attachments (#1411) * fix: issue attachments (#1422) * chore: file size limit for pro workspaces (#1437) * chore: file size limit for pro * chore: update maximum file size logic * chore: update editor max file size logic * chore: update max file size limit logic * chore: add comments * fix: close modal after removing workspace logo * chore: update uploaded asstes' status post issue creation * chore: memoize max file size var * chore: check for pro file size limits * chore: added file size limit to the space app --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> * chore: add max file size limit to workspace pages (#1440) * fix: remove old workspace logo and user avatar (#1445) * fix: intake exception error (#5810) * chore: filtered active cycles for guest (#1468) * fix: build error --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
2024-10-12 01:47:13 +05:30
<Avatar name={cycleOwnerDetails?.display_name} src={getFileURL(cycleOwnerDetails?.avatar_url ?? "")} />
{cycleAssignee.length > 0 && (
<span className="pl-2">
<AvatarGroup showTooltip>
{cycleAssignee.map((member) => (
<Avatar
key={member.assignee_id}
name={member?.display_name ?? ""}
fix: merge conflicts and build errors (#1469) * dev: private bucket implementation (#1339) * chore: migrations and backmigration to move attachments to file asset * chore: move attachments to file assets * chore: update migration file to include created by and updated by and size * chore: remove uninmport errors * chore: make size as float field * fix: file asset uploads * chore: asset uploads migration changes * chore: v2 assets endpoint * chore: remove unused imports * chore: issue attachments * chore: issue attachments * chore: workspace logo endpoints * chore: private bucket changes * chore: user asset endpoint * chore: add logo_url validation * chore: cover image urlk * chore: change asset max length * chore: pages endpoint * chore: store the storage_metadata only when none * chore: attachment asset apis * chore: update create private bucket * chore: make bucket private * chore: fix response of user uploads * fix: response of user uploads * fix: job to fix file asset uploads * fix: user asset endpoints * chore: avatar for user profile * chore: external apis user url endpoint * chore: upload workspace and user asset actions updated * chore: analytics endpoint * fix: analytics export * chore: avatar urls * chore: update user avatar instances * chore: avatar urls for assignees and creators * chore: bucket permission script * fix: all user avatr instances in the web app * chore: update project cover image logic * fix: issue attachment endpoint * chore: patch endpoint for issue attachment * chore: attachments * chore: change attachment storage class * chore: update issue attachment endpoints * fix: issue attachment * chore: update issue attachment implementation * chore: page asset endpoints * fix: web build errors * chore: attachments * chore: page asset urls * chore: comment and issue asset endpoints * chore: asset endpoints * chore: attachment endpoints * chore: bulk asset endpoint * chore: restore endpoint * chore: project assets endpoints * chore: asset url * chore: add delete asset endpoints * chore: fix asset upload endpoint * chore: update patch endpoints * chore: update patch endpoint * chore: update editor image handling * chore: asset restore endpoints * chore: avatar url for space assets * chore: space app assets migration * fix: space app urls * chore: space endpoints * fix: old editor images rendering logic * fix: issue archive and attachment activity * chore: asset deletes * chore: update images * chore: attachment delete * fix: issue attachment * fix: issue attachment get * chore: cover image url for projects * chore: remove duplicate py file * fix: url check function * chore: chore project cover asset delete * fix: migrations * chore: delete migration files --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> * fix: private bucket build errors (#1347) * fix: private bucket build errors * fix: build errors * revert: issue type select changes. (#1355) * chore: private bucket implementation for workspace level pages (#1371) * chore: update project modal * chore: update rich-text read-only editor * chore: update workspace pages' components * chore: remove entity identifier in favour of multiple columns of entities (#1405) * fix: issue attachments (#1411) * fix: issue attachments (#1422) * chore: file size limit for pro workspaces (#1437) * chore: file size limit for pro * chore: update maximum file size logic * chore: update editor max file size logic * chore: update max file size limit logic * chore: add comments * fix: close modal after removing workspace logo * chore: update uploaded asstes' status post issue creation * chore: memoize max file size var * chore: check for pro file size limits * chore: added file size limit to the space app --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> * chore: add max file size limit to workspace pages (#1440) * fix: remove old workspace logo and user avatar (#1445) * fix: intake exception error (#5810) * chore: filtered active cycles for guest (#1468) * fix: build error --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
2024-10-12 01:47:13 +05:30
src={getFileURL(member?.avatar_url ?? "")}
showTooltip={false}
/>
))}
</AvatarGroup>
</span>
)}
</div>
</div>
<Link
href={`/${workspaceSlug}/projects/${projectId}/cycles/${cycle.id}`}
className={`${getButtonStyling("outline-primary", "sm")} cursor-pointer`}
>
View cycle
</Link>
</div>
</div>
);
};