fix: icon consistency for issue properties (#3065)

This commit is contained in:
Aaryan Khandelwal 2023-12-11 17:27:29 +05:30 committed by GitHub
parent 1bf064df15
commit b629263bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 61 additions and 54 deletions

View File

@ -97,7 +97,7 @@ export const CycleForm: React.FC<Props> = (props) => {
id="cycle_description" id="cycle_description"
name="description" name="description"
placeholder="Description..." placeholder="Description..."
className="h-24 w-full resize-none text-sm" className="!h-24 w-full resize-none text-sm"
hasError={Boolean(errors?.description)} hasError={Boolean(errors?.description)}
value={value} value={value}
onChange={onChange} onChange={onChange}
@ -135,18 +135,12 @@ export const CycleForm: React.FC<Props> = (props) => {
</div> </div>
</div> </div>
</div> </div>
<div className="mt-5 flex items-center justify-end gap-2 border-t-[0.5px] border-custom-border-100 pt-5 "> <div className="flex items-center justify-end gap-2 border-t-[0.5px] border-custom-border-100 pt-5 ">
<Button variant="neutral-primary" size="sm" onClick={handleClose}> <Button variant="neutral-primary" size="sm" onClick={handleClose}>
Cancel Cancel
</Button> </Button>
<Button variant="primary" size="sm" type="submit" loading={isSubmitting}> <Button variant="primary" size="sm" type="submit" loading={isSubmitting}>
{data {data ? (isSubmitting ? "Updating" : "Update cycle") : isSubmitting ? "Creating" : "Create cycle"}
? isSubmitting
? "Updating Cycle..."
: "Update Cycle"
: isSubmitting
? "Creating Cycle..."
: "Create Cycle"}
</Button> </Button>
</div> </div>
</form> </form>

View File

@ -226,10 +226,9 @@ export const IssueForm: FC<IssueFormProps> = observer((props) => {
reset({ reset({
...defaultValues, ...defaultValues,
project: projectId,
...initialData, ...initialData,
}); });
}, [setFocus, initialData, projectId, reset]); }, [setFocus, initialData, reset]);
// update projectId in form when projectId changes // update projectId in form when projectId changes
useEffect(() => { useEffect(() => {

View File

@ -124,7 +124,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
value={issue?.start_date || null} value={issue?.start_date || null}
onChange={(date: string) => handleStartDate(date)} onChange={(date: string) => handleStartDate(date)}
disabled={isReadOnly} disabled={isReadOnly}
placeHolder="Start date" type="start_date"
/> />
)} )}
@ -134,7 +134,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer((props) =>
value={issue?.target_date || null} value={issue?.target_date || null}
onChange={(date: string) => handleTargetDate(date)} onChange={(date: string) => handleTargetDate(date)}
disabled={isReadOnly} disabled={isReadOnly}
placeHolder="Target date" type="target_date"
/> />
)} )}

View File

@ -108,7 +108,7 @@ export const ListProperties: FC<IListProperties> = observer((props) => {
value={issue?.start_date || null} value={issue?.start_date || null}
onChange={(date: string) => handleStartDate(date)} onChange={(date: string) => handleStartDate(date)}
disabled={isReadonly} disabled={isReadonly}
placeHolder="Start date" type="start_date"
/> />
)} )}
@ -118,7 +118,7 @@ export const ListProperties: FC<IListProperties> = observer((props) => {
value={issue?.target_date || null} value={issue?.target_date || null}
onChange={(date: string) => handleTargetDate(date)} onChange={(date: string) => handleTargetDate(date)}
disabled={isReadonly} disabled={isReadonly}
placeHolder="Target date" type="target_date"
/> />
)} )}

View File

@ -3,7 +3,7 @@ import { observer } from "mobx-react-lite";
import { useMobxStore } from "lib/mobx/store-provider"; import { useMobxStore } from "lib/mobx/store-provider";
import { usePopper } from "react-popper"; import { usePopper } from "react-popper";
import { Combobox } from "@headlessui/react"; import { Combobox } from "@headlessui/react";
import { Check, ChevronDown, Search, User2 } from "lucide-react"; import { Check, ChevronDown, CircleUser, Search } from "lucide-react";
// ui // ui
import { Avatar, AvatarGroup, Tooltip } from "@plane/ui"; import { Avatar, AvatarGroup, Tooltip } from "@plane/ui";
// types // types
@ -110,8 +110,8 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
})} })}
</AvatarGroup> </AvatarGroup>
) : ( ) : (
<span className="flex h-5 w-5 items-end justify-center rounded-full border border-dashed border-custom-text-400 bg-custom-background-80"> <span className="h-5 w-5 grid place-items-center">
<User2 className="h-4 w-4 text-custom-text-400" /> <CircleUser className="h-4 w-4" strokeWidth={1.5} />
</span> </span>
)} )}
</div> </div>
@ -140,7 +140,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
ref={setReferenceElement} ref={setReferenceElement}
type="button" type="button"
className={`flex w-full items-center justify-between gap-1 text-xs ${ className={`flex w-full items-center justify-between gap-1 text-xs ${
disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80" disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer"
} ${buttonClassName}`} } ${buttonClassName}`}
onClick={() => !projectMembers && getWorkspaceMembers()} onClick={() => !projectMembers && getWorkspaceMembers()}
> >

View File

@ -2,7 +2,7 @@ import React from "react";
// headless ui // headless ui
import { Popover } from "@headlessui/react"; import { Popover } from "@headlessui/react";
// lucide icons // lucide icons
import { Calendar, X } from "lucide-react"; import { CalendarCheck2, CalendarClock, X } from "lucide-react";
// react date picker // react date picker
import DatePicker from "react-datepicker"; import DatePicker from "react-datepicker";
// mobx // mobx
@ -18,11 +18,24 @@ export interface IIssuePropertyDate {
value: any; value: any;
onChange: (date: any) => void; onChange: (date: any) => void;
disabled?: boolean; disabled?: boolean;
placeHolder?: string; type: "start_date" | "target_date";
} }
const DATE_OPTIONS = {
start_date: {
key: "start_date",
placeholder: "Start date",
icon: CalendarClock,
},
target_date: {
key: "target_date",
placeholder: "Target date",
icon: CalendarCheck2,
},
};
export const IssuePropertyDate: React.FC<IIssuePropertyDate> = observer((props) => { export const IssuePropertyDate: React.FC<IIssuePropertyDate> = observer((props) => {
const { value, onChange, disabled, placeHolder } = props; const { value, onChange, disabled, type } = props;
const dropdownBtn = React.useRef<any>(null); const dropdownBtn = React.useRef<any>(null);
const dropdownOptions = React.useRef<any>(null); const dropdownOptions = React.useRef<any>(null);
@ -31,6 +44,8 @@ export const IssuePropertyDate: React.FC<IIssuePropertyDate> = observer((props)
useDynamicDropdownPosition(isOpen, () => setIsOpen(false), dropdownBtn, dropdownOptions); useDynamicDropdownPosition(isOpen, () => setIsOpen(false), dropdownBtn, dropdownOptions);
const dateOptionDetails = DATE_OPTIONS[type];
return ( return (
<Popover as="div" className="relative"> <Popover as="div" className="relative">
{({ open }) => { {({ open }) => {
@ -49,10 +64,10 @@ export const IssuePropertyDate: React.FC<IIssuePropertyDate> = observer((props)
}`} }`}
> >
<div className="flex items-center justify-center gap-2 overflow-hidden"> <div className="flex items-center justify-center gap-2 overflow-hidden">
<Calendar className="h-3 w-3" strokeWidth={2} /> <dateOptionDetails.icon className="h-3 w-3" strokeWidth={2} />
{value && ( {value && (
<> <>
<Tooltip tooltipHeading={placeHolder} tooltipContent={value ?? "None"}> <Tooltip tooltipHeading={dateOptionDetails.placeholder} tooltipContent={value ?? "None"}>
<div className="text-xs">{value}</div> <div className="text-xs">{value}</div>
</Tooltip> </Tooltip>

View File

@ -6,7 +6,7 @@ import { usePopper } from "react-popper";
// components // components
import { Combobox } from "@headlessui/react"; import { Combobox } from "@headlessui/react";
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
import { Check, ChevronDown, Search } from "lucide-react"; import { Check, ChevronDown, Search, Tags } from "lucide-react";
// types // types
import { Placement } from "@popperjs/core"; import { Placement } from "@popperjs/core";
import { RootStore } from "store/root"; import { RootStore } from "store/root";
@ -25,6 +25,7 @@ export interface IIssuePropertyLabels {
placement?: Placement; placement?: Placement;
maxRender?: number; maxRender?: number;
noLabelBorder?: boolean; noLabelBorder?: boolean;
placeholderText?: string;
} }
export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((props) => { export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((props) => {
@ -41,6 +42,7 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
placement, placement,
maxRender = 2, maxRender = 2,
noLabelBorder = false, noLabelBorder = false,
placeholderText,
} = props; } = props;
const { const {
@ -144,11 +146,12 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
) )
) : ( ) : (
<div <div
className={`flex h-full items-center justify-center rounded px-2.5 py-1 text-xs hover:bg-custom-background-80 ${ className={`h-full flex items-center justify-center gap-2 rounded px-2.5 py-1 text-xs hover:bg-custom-background-80 ${
noLabelBorder ? "" : "border-[0.5px] border-custom-border-300" noLabelBorder ? "" : "border-[0.5px] border-custom-border-300"
}`} }`}
> >
Select labels <Tags className="h-3.5 w-3.5" strokeWidth={2} />
{placeholderText}
</div> </div>
)} )}
</div> </div>

View File

@ -31,10 +31,10 @@ export const SpreadsheetLabelColumn: React.FC<Props> = (props) => {
onChange={(data) => onChange({ labels: data })} onChange={(data) => onChange({ labels: data })}
className="h-full w-full" className="h-full w-full"
buttonClassName="px-2.5 h-full" buttonClassName="px-2.5 h-full"
noLabelBorder
hideDropdownArrow hideDropdownArrow
maxRender={1} maxRender={1}
disabled={disabled} disabled={disabled}
placeholderText="Select labels"
/> />
{isExpanded && {isExpanded &&

View File

@ -1,5 +1,4 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import type { FieldError } from "react-hook-form"; import type { FieldError } from "react-hook-form";
// mobx store // mobx store
@ -23,9 +22,6 @@ export const IssueProjectSelect: React.FC<IssueProjectSelectProps> = observer((p
const { value, onChange } = props; const { value, onChange } = props;
const [query, setQuery] = useState(""); const [query, setQuery] = useState("");
const router = useRouter();
const { workspaceSlug } = router.query;
const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null); const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null);
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null); const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
@ -33,13 +29,13 @@ export const IssueProjectSelect: React.FC<IssueProjectSelectProps> = observer((p
placement: "bottom-start", placement: "bottom-start",
}); });
const { project: projectStore } = useMobxStore(); const {
project: { joinedProjects },
} = useMobxStore();
const projects = workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : undefined; const selectedProject = joinedProjects?.find((i) => i.id === value);
const selectedProject = projects?.find((i) => i.id === value); const options = joinedProjects?.map((project) => ({
const options = projects?.map((project) => ({
value: project.id, value: project.id,
query: project.name, query: project.name,
content: ( content: (

View File

@ -1,7 +1,7 @@
// ui // ui
import { CustomDatePicker } from "components/ui"; import { CustomDatePicker } from "components/ui";
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
import { CalendarDays } from "lucide-react"; import { CalendarCheck } from "lucide-react";
// helpers // helpers
import { import {
findHowManyDaysLeft, findHowManyDaysLeft,
@ -67,7 +67,7 @@ export const ViewDueDateSelect: React.FC<Props> = ({
> >
{issue.target_date ? ( {issue.target_date ? (
<> <>
<CalendarDays className="h-3.5 w-3.5 flex-shrink-0" /> <CalendarCheck className="h-3.5 w-3.5 flex-shrink-0" />
<span> <span>
{areYearsEqual {areYearsEqual
? renderShortDate(issue.target_date ?? "", "_ _") ? renderShortDate(issue.target_date ?? "", "_ _")
@ -76,7 +76,7 @@ export const ViewDueDateSelect: React.FC<Props> = ({
</> </>
) : ( ) : (
<> <>
<CalendarDays className="h-3.5 w-3.5 flex-shrink-0" /> <CalendarCheck className="h-3.5 w-3.5 flex-shrink-0" />
<span>Due Date</span> <span>Due Date</span>
</> </>
)} )}

View File

@ -1,7 +1,7 @@
// ui // ui
import { CustomDatePicker } from "components/ui"; import { CustomDatePicker } from "components/ui";
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
import { CalendarDays } from "lucide-react"; import { CalendarClock } from "lucide-react";
// helpers // helpers
import { renderShortDate, renderShortDateWithYearFormat, renderShortMonthDate } from "helpers/date-time.helper"; import { renderShortDate, renderShortDateWithYearFormat, renderShortMonthDate } from "helpers/date-time.helper";
// types // types
@ -55,7 +55,7 @@ export const ViewStartDateSelect: React.FC<Props> = ({
> >
{issue?.start_date ? ( {issue?.start_date ? (
<> <>
<CalendarDays className="h-3.5 w-3.5 flex-shrink-0" /> <CalendarClock className="h-3.5 w-3.5 flex-shrink-0" />
<span> <span>
{areYearsEqual {areYearsEqual
? renderShortDate(issue?.start_date, "_ _") ? renderShortDate(issue?.start_date, "_ _")
@ -64,7 +64,7 @@ export const ViewStartDateSelect: React.FC<Props> = ({
</> </>
) : ( ) : (
<> <>
<CalendarDays className="h-3.5 w-3.5 flex-shrink-0" /> <CalendarClock className="h-3.5 w-3.5 flex-shrink-0" />
<span>Start Date</span> <span>Start Date</span>
</> </>
)} )}

View File

@ -1,6 +1,6 @@
import { TIssueOrderByOptions } from "types"; import { TIssueOrderByOptions } from "types";
import { LayersIcon, DoubleCircleIcon, UserGroupIcon } from "@plane/ui"; import { LayersIcon, DoubleCircleIcon, UserGroupIcon } from "@plane/ui";
import { CalendarDays, Link2, Signal, Tag, Triangle, Paperclip } from "lucide-react"; import { CalendarDays, Link2, Signal, Tag, Triangle, Paperclip, CalendarClock, CalendarCheck } from "lucide-react";
import { FC } from "react"; import { FC } from "react";
import { ISvgIcons } from "@plane/ui/src/icons/type"; import { ISvgIcons } from "@plane/ui/src/icons/type";
@ -36,7 +36,7 @@ export const SPREADSHEET_PROPERTY_DETAILS: {
ascendingOrderTitle: "New", ascendingOrderTitle: "New",
descendingOrderKey: "target_date", descendingOrderKey: "target_date",
descendingOrderTitle: "Old", descendingOrderTitle: "Old",
icon: CalendarDays, icon: CalendarCheck,
}, },
estimate: { estimate: {
title: "Estimate", title: "Estimate",
@ -68,7 +68,7 @@ export const SPREADSHEET_PROPERTY_DETAILS: {
ascendingOrderTitle: "New", ascendingOrderTitle: "New",
descendingOrderKey: "start_date", descendingOrderKey: "start_date",
descendingOrderTitle: "Old", descendingOrderTitle: "Old",
icon: CalendarDays, icon: CalendarClock,
}, },
state: { state: {
title: "State", title: "State",