The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
header component added (#3539)
Suman Sahoo096f005562cf
diff --git a/packages/twenty-front/src/modules/activities/emails/components/ThreadHeader.tsx b/packages/twenty-front/src/modules/activities/emails/components/ThreadHeader.tsxnew file mode 100644index 00000000000..8d8a2bb6284--- /dev/null+++ b/packages/twenty-front/src/modules/activities/emails/components/ThreadHeader.tsx@@ -0,0 +1,54 @@+import styled from '@emotion/styled';++import { IconMail } from '@/ui/display/icon';+import { Tag } from '@/ui/display/tag/components/Tag';+import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';+interface ThreadHeaderProps {+ subject: string;+ lastMessageSentAt: Date;+}++const StyledContainer = styled.div`+ align-items: flex-start;+ display: flex;+ flex-direction: column;+ padding: ${({ theme }) => theme.spacing(6)};+ gap: ${({ theme }) => theme.spacing(6)};+ border-bottom: 1px solid ${({ theme }) => theme.border.color.medium};+ background: ${({ theme }) => theme.background.secondary};+`;++const StyledHead = styled.div`+ width: 100%;+`;++const StyledHeading = styled.h2`+ margin: 0;+ margin-bottom: ${({ theme }) => theme.spacing(3)};+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+`;++const StyledContent = styled.span`+ color: ${({ theme }) => theme.font.color.tertiary};+ width: 100%;+`;++export const ThreadHeader = ({+ subject,+ lastMessageSentAt,+}: ThreadHeaderProps) => {+ return (+ <StyledContainer>+ <Tag Icon={IconMail} color="gray" text="Email" onClick={() => {}} />+ <StyledHead>+ <StyledHeading>{subject}</StyledHeading>+ <StyledContent>+ Last message {beautifyPastDateRelativeToNow(lastMessageSentAt)}+ </StyledContent>+ </StyledHead>+ </StyledContainer>+ );+};diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerThread.tsx b/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerThread.tsxindex aa6df035845..b38a2d73b3d 100644--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerThread.tsx+++ b/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerThread.tsx@@ -1,6 +1,8 @@import React from 'react';import styled from '@emotion/styled';+import { ThreadHeader } from '@/activities/emails/components/ThreadHeader';+const StyledContainer = styled.div`box-sizing: border-box;display: flex;@@ -12,9 +14,16 @@ const StyledContainer = styled.div``;export const RightDrawerThread = () => {+ const mockedThread = {+ subject: 'Tes with long subject, very long subject, very long subject',+ receivedAt: new Date(),+ };return (<StyledContainer>- <></>+ <ThreadHeader+ subject={mockedThread.subject}+ lastMessageSentAt={mockedThread.receivedAt}+ /></StyledContainer>);};diff --git a/packages/twenty-front/src/modules/ui/display/tag/components/Tag.tsx b/packages/twenty-front/src/modules/ui/display/tag/components/Tag.tsxindex f0b534128e0..51c84d6f8db 100644--- a/packages/twenty-front/src/modules/ui/display/tag/components/Tag.tsx+++ b/packages/twenty-front/src/modules/ui/display/tag/components/Tag.tsx@@ -1,5 +1,7 @@+import { useTheme } from '@emotion/react';import styled from '@emotion/styled';+import { IconComponent } from '@/ui/display/icon/types/IconComponent';import { ThemeColor } from '@/ui/theme/constants/colors';import { themeColorSchema } from '@/ui/theme/utils/themeColorSchema';@@ -30,12 +32,18 @@ const StyledContent = styled.span`white-space: nowrap;`;+const StyledIconContainer = styled.div`+ display: flex;+ margin-right: ${({ theme }) => theme.spacing(1)};+`;+type TagWeight = 'regular' | 'medium';type TagProps = {className?: string;color: ThemeColor;text: string;+ Icon?: IconComponent;onClick?: () => void;weight?: TagWeight;};@@ -44,15 +52,24 @@ export const Tag = ({className,color,text,+ Icon,onClick,weight = 'regular',-}: TagProps) => (- <StyledTag- className={className}- color={themeColorSchema.catch('gray').parse(color)}- onClick={onClick}- weight={weight}- >- <StyledContent>{text}</StyledContent>- </StyledTag>-);+}: TagProps) => {+ const theme = useTheme();+ return (+ <StyledTag+ className={className}+ color={themeColorSchema.catch('gray').parse(color)}+ onClick={onClick}+ weight={weight}+ >+ {!!Icon && (+ <StyledIconContainer>+ <Icon size={theme.icon.size.sm} stroke={theme.icon.stroke.sm} />+ </StyledIconContainer>+ )}+ <StyledContent>{text}</StyledContent>+ </StyledTag>+ );+};