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

Fix verticale line timeline activity #5894

Merged
merged 1 commit into from
Jun 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ import { TimelineActivity } from '@/activities/timelineActivities/types/Timeline
import { getTimelineActivityAuthorFullName } from '@/activities/timelineActivities/utils/getTimelineActivityAuthorFullName';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';

const StyledTimelineItemContainer = styled.div`
display: flex;
gap: ${({ theme }) => theme.spacing(4)};
height: 'auto';
justify-content: space-between;
overflow: hidden;
white-space: nowrap;
`;

const StyledLeftContainer = styled.div`
display: flex;
flex-direction: column;
`;

const StyledIconContainer = styled.div`
display: flex;
align-items: center;
Expand All @@ -25,62 +38,50 @@ const StyledIconContainer = styled.div`
user-select: none;
text-decoration-line: underline;
z-index: 2;
align-self: normal;
`;

const StyledItemContainer = styled.div`
display: flex;
align-items: center;
gap: ${({ theme }) => theme.spacing(1)};
flex: 1;
overflow: hidden;
`;

const StyledItemTitleDate = styled.div`
align-items: center;
color: ${({ theme }) => theme.font.color.tertiary};
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
justify-content: flex-end;
margin-left: auto;
align-self: baseline;
`;

const StyledVerticalLineContainer = styled.div`
align-items: center;
align-self: stretch;
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
flex-shrink: 0;
justify-content: center;
width: 26px;
z-index: 2;
height: 100%;
`;

const StyledVerticalLine = styled.div`
align-self: stretch;
background: ${({ theme }) => theme.border.color.light};
flex-shrink: 0;
width: 2px;
height: 100%;
`;

const StyledTimelineItemContainer = styled.div<{ isGap?: boolean }>`
display: flex;
const StyledSummary = styled.summary`
align-items: center;
justify-content: space-between;
gap: ${({ theme }) => theme.spacing(4)};
height: ${({ isGap, theme }) =>
isGap ? (useIsMobile() ? theme.spacing(6) : theme.spacing(3)) : 'auto'};
overflow: hidden;
white-space: nowrap;
display: flex;
flex: 1;
flex-direction: row;
gap: ${({ theme }) => theme.spacing(1)};
`;

const StyledSummary = styled.summary`
const StyledItemContainer = styled.div<{ isMarginBottom?: boolean }>`
align-items: flex-start;
display: flex;
flex: 1;
flex-direction: row;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(1)};
align-items: center;
overflow: hidden;
margin-bottom: ${({ isMarginBottom, theme }) =>
isMarginBottom ? theme.spacing(3) : 0};
min-height: 26px;
`;

const StyledItemTitleDate = styled.div`
align-items: flex-start;
padding-top: ${({ theme }) => theme.spacing(1)};
color: ${({ theme }) => theme.font.color.tertiary};
display: flex;
gap: ${({ theme }) => theme.spacing(1)};
justify-content: flex-end;
margin-left: auto;
`;

type EventRowProps = {
Expand Down Expand Up @@ -118,13 +119,20 @@ export const EventRow = ({
return (
<>
<StyledTimelineItemContainer>
<StyledIconContainer>
<EventIconDynamicComponent
event={event}
linkedObjectMetadataItem={linkedObjectMetadataItem}
/>
</StyledIconContainer>
<StyledItemContainer>
<StyledLeftContainer>
<StyledIconContainer>
<EventIconDynamicComponent
event={event}
linkedObjectMetadataItem={linkedObjectMetadataItem}
/>
</StyledIconContainer>
{!isLastEvent && (
<StyledVerticalLineContainer>
<StyledVerticalLine />
</StyledVerticalLineContainer>
)}
</StyledLeftContainer>
<StyledItemContainer isMarginBottom={!isLastEvent}>
<StyledSummary>
<EventRowDynamicComponent
authorFullName={authorFullName}
Expand All @@ -134,18 +142,11 @@ export const EventRow = ({
linkedObjectMetadataItem={linkedObjectMetadataItem}
/>
</StyledSummary>
<StyledItemTitleDate id={`id-${event.id}`}>
{beautifiedCreatedAt}
</StyledItemTitleDate>
</StyledItemContainer>
<StyledItemTitleDate id={`id-${event.id}`}>
{beautifiedCreatedAt}
</StyledItemTitleDate>
</StyledTimelineItemContainer>
{!isLastEvent && (
<StyledTimelineItemContainer isGap>
<StyledVerticalLineContainer>
<StyledVerticalLine />
</StyledVerticalLineContainer>
</StyledTimelineItemContainer>
)}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const StyledCardContainer = styled.div`
gap: ${({ theme }) => theme.spacing(2)};
width: 400px;
padding: ${({ theme }) => theme.spacing(2)} 0px
${({ theme }) => theme.spacing(4)} 0px;
${({ theme }) => theme.spacing(1)} 0px;
`;

const StyledCard = styled(Card)`
Expand Down
Loading