Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-1501] chore: render default state conditionally in the state dropdown #4669

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions web/components/dropdowns/state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ type Props = TDropdownProps & {
onChange: (val: string) => void;
onClose?: () => void;
projectId: string;
value: string;
showDefaultState?: boolean;
value: string | undefined;
};

export const StateDropdown: React.FC<Props> = observer((props) => {
Expand All @@ -42,6 +43,7 @@ export const StateDropdown: React.FC<Props> = observer((props) => {
onClose,
placement,
projectId,
showDefaultState = true,
showTooltip = false,
tabIndex,
value,
Expand Down Expand Up @@ -72,8 +74,8 @@ export const StateDropdown: React.FC<Props> = observer((props) => {
const { workspaceSlug } = useAppRouter();
const { fetchProjectStates, getProjectStates, getStateById } = useProjectState();
const statesList = getProjectStates(projectId);
const defaultStateList = statesList?.find((state) => state.default);
const stateValue = value ? value : defaultStateList?.id;
const defaultState = statesList?.find((state) => state.default);
const stateValue = value ?? (showDefaultState ? defaultState?.id : undefined);

const options = statesList?.map((state) => ({
value: state.id,
Expand Down Expand Up @@ -170,7 +172,7 @@ export const StateDropdown: React.FC<Props> = observer((props) => {
{!hideIcon && (
<StateGroupIcon
stateGroup={selectedState?.group ?? "backlog"}
color={selectedState?.color}
color={selectedState?.color ?? "rgba(var(--color-text-300))"}
className="h-3 w-3 flex-shrink-0"
/>
)}
Expand Down
Loading