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

Remove code from mobile view of setting bounty status as open if github issue is open #1164

Merged
merged 7 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions frontend/app/src/people/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ export interface PersonProps extends Person {
description: string;
}

export interface GithubStatusPillProps {
status?: string;
export interface StatusPillProps {
assignee?: Person;
style?: React.CSSProperties;
}
Expand Down
48 changes: 5 additions & 43 deletions frontend/app/src/people/widgetViews/parts/StatusPill.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
import { GithubStatusPillProps } from 'people/interfaces';
import { StatusPillProps } from 'people/interfaces';
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';

interface PillProps {
readonly isOpen: boolean;
}
const Pill = styled.div<PillProps>`
display: flex;
justify-content: center;
align-items: center;
font-size: 12px;
font-weight: 300;
background: ${(p: any) => (p.isOpen ? '#49C998' : '#8256D0')};
border-radius: 30px;
border: 1px solid transparent;
text-transform: capitalize;
padding: 12px 5px;
// padding:8px;
font-size: 12px;
font-weight: 500;
line-height: 20px;
white-space: nowrap;
border-radius: 2em;
height: 26px;
color: #fff;
margin-right: 10px;
width: 58px;
height: 22px;
left: 19px;
top: 171px;

/* Primary Green */

border-radius: 2px;
`;

const Assignee = styled.div`
display: flex;
justify-content: center;
Expand All @@ -55,28 +22,23 @@ const W = styled.div`
display: flex;
align-items: center;
`;
export default function GithubStatusPill(props: GithubStatusPillProps) {
const { status, assignee, style } = props;
export default function StatusPill(props: StatusPillProps) {
const { assignee, style } = props;

const [assigneText, setAssigneText] = useState('');

const isOpen = status === 'open' || !status;

useEffect(() => {
const assignedText =
assignee && !assignee?.owner_alias
? 'Not assigned'
: isOpen
: assignee
? 'Assigned to '
: 'Completed by ';
setAssigneText(assignedText);
}, [isOpen, assignee]);
}, [assignee]);

return (
<div style={{ display: 'flex', ...style }}>
<Pill isOpen={isOpen}>
<div>{isOpen ? 'Open' : 'Closed'}</div>
</Pill>
<W>
<Assignee>{assigneText}</Assignee>
</W>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { EuiText } from '@elastic/eui';
import { CodingViewProps } from 'people/interfaces';
import { Divider, Paragraph, Title } from '../../../../components/common';
import GithubStatusPill from '../../parts/StatusPill';
import StatusPill from '../../parts/StatusPill';
import LoomViewerRecorder from '../../../utils/LoomViewerRecorder';
import { colors } from '../../../../config/colors';
import { renderMarkdown } from '../../../utils/RenderMarkdown';
Expand All @@ -26,7 +26,6 @@ export default function DesktopView(props: CodingViewProps) {
assigneeLabel,
nametag,
actionButtons,
status,
owner_id,
created
} = props;
Expand Down Expand Up @@ -60,7 +59,7 @@ export default function DesktopView(props: CodingViewProps) {
<SectionPad style={{ minHeight: 160, maxHeight: 160 }}>
<Title>{titleString}</Title>
<div style={{ display: 'flex', marginTop: 12 }}>
<GithubStatusPill status={status} assignee={assignee} style={{ marginRight: 25 }} />
<StatusPill assignee={assignee} style={{ marginRight: 25 }} />
{assigneeLabel}
{ticketUrl && (
<GithubIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';
import { EuiText } from '@elastic/eui';
import { CodingViewProps } from 'people/interfaces';
import GithubStatusPill from '../../parts/StatusPill';
import StatusPill from '../../parts/StatusPill';
import { Divider } from '../../../../components/common';
import LoomViewerRecorder from '../../../utils/LoomViewerRecorder';
import { colors } from '../../../../config/colors';
Expand Down Expand Up @@ -30,7 +30,6 @@ export default function MobileView(props: CodingViewProps) {
nametag,
assigneeLabel,
labels,
status,
payBounty,
showPayBounty,
markUnpaid
Expand All @@ -51,7 +50,7 @@ export default function MobileView(props: CodingViewProps) {
flexDirection: 'row'
}}
>
<GithubStatusPill status={status} assignee={assignee} />
<StatusPill assignee={assignee} />
{assigneeLabel}
{ticketUrl && (
<GithubIconMobile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { EuiButtonIcon, EuiText } from '@elastic/eui';
import { observer } from 'mobx-react-lite';
import { WantedViewsProps } from 'people/interfaces';
import GithubStatusPill from '../parts/StatusPill';
import StatusPill from '../parts/StatusPill';
import { colors } from '../../../config/colors';
import NameTag from '../../utils/NameTag';
import { useStores } from '../../../store';
Expand Down Expand Up @@ -34,7 +34,6 @@ function DesktopView(props: WantedViewsProps) {
labels,
isClosed,
onPanelClick,
status,
isCodingTask,
show,
paid,
Expand Down Expand Up @@ -86,8 +85,7 @@ function DesktopView(props: WantedViewsProps) {
}}
>
{isCodingTask ? (
<GithubStatusPill
status={status}
<StatusPill
assignee={assignee}
style={{
marginTop: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';
import { EuiButtonIcon, EuiText } from '@elastic/eui';
import { observer } from 'mobx-react-lite';
import GithubStatusPill from '../parts/StatusPill';
import StatusPill from '../parts/StatusPill';
import { colors } from '../../../config/colors';
import NameTag from '../../utils/NameTag';
import { useStores } from '../../../store';
Expand Down Expand Up @@ -38,7 +38,6 @@ function MobileView(props: any) {
saving,
labels,
isClosed,
status,
isCodingTask,
show,
paid,
Expand Down Expand Up @@ -103,8 +102,7 @@ function MobileView(props: any) {
}}
>
{isCodingTask && (
<GithubStatusPill
status={status}
<StatusPill
assignee={assignee}
style={{
marginTop: 10
Expand Down
Loading