Skip to content

Commit

Permalink
feat: show detail of status when only time is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
cutls committed Jun 12, 2024
1 parent 70be916 commit 98e0c71
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
3 changes: 3 additions & 0 deletions renderer/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@

time {
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions renderer/components/timelines/status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ const Status: React.FC<Props> = (props) => {
open(url)
e.preventDefault()
e.stopPropagation()
} else {
if (props.setStatusDetail) {
props.setStatusDetail(props.status.id, props.server.id, props.account?.id)
}
}
}

Expand Down Expand Up @@ -181,7 +177,6 @@ const Status: React.FC<Props> = (props) => {
<FlexboxGrid.Item
colspan={18}
style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}
onClick={() => props.setAccountDetail(status.account.id, props.server.id, props.account?.id)}
>
<span dangerouslySetInnerHTML={{ __html: emojify(status.account.display_name, status.account.emojis) }} />
<span style={{ color: 'var(--rs-text-tertiary)' }}>@{status.account.acct}</span>
Expand Down
18 changes: 9 additions & 9 deletions renderer/components/utils/Time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ const parseDatetime = (timestamp: string) => {
const Time: React.FC<Props> = (props) => {
const { timelineConfig } = useContext(TheDeskContext)
const fullday = dayjs(props.time).format('YYYY/M/D H:mm:ss (A h:mm:ss)')
const absStyle = { fontSize: '0.8rem' }
const absStyle = {...props.style, fontSize: '0.8rem' }
if ( timelineConfig.time === 'absolute') {
if (dayjs(props.time).year() !== dayjs().year()) return <span title={fullday} style={absStyle}>{dayjs(props.time).format('YYYY/M/D H:mm')}</span>
if (dayjs(props.time).month() !== dayjs().month()) return <span title={fullday} style={absStyle}>{dayjs(props.time).format('M/D H:mm')}</span>
if (dayjs(props.time).date() !== dayjs().date()) return <span title={fullday} style={absStyle}>{dayjs(props.time).format('M/D H:mm')}</span>
return <span title={fullday} style={absStyle}>{dayjs(props.time).format('H:mm:ss')}</span>
if (dayjs(props.time).year() !== dayjs().year()) return <time title={fullday} style={absStyle}>{dayjs(props.time).format('YYYY/M/D H:mm')}</time>
if (dayjs(props.time).month() !== dayjs().month()) return <time title={fullday} style={absStyle}>{dayjs(props.time).format('M/D H:mm')}</time>
if (dayjs(props.time).date() !== dayjs().date()) return <time title={fullday} style={absStyle}>{dayjs(props.time).format('M/D H:mm')}</time>
return <time title={fullday} style={absStyle}>{dayjs(props.time).format('H:mm:ss')}</time>
}
if ( timelineConfig.time === '12h') {
if (dayjs(props.time).year() !== dayjs().year()) return <span title={fullday} style={absStyle}>{dayjs(props.time).format('YYYY/M/D A h:mm')}</span>
if (dayjs(props.time).month() !== dayjs().month()) return <span title={fullday} style={absStyle}>{dayjs(props.time).format('M/D A h:mm')}</span>
if (dayjs(props.time).date() !== dayjs().date()) return <span title={fullday} style={absStyle}>{dayjs(props.time).format('M/D A h:mm')}</span>
return <span title={fullday} style={absStyle}>{dayjs(props.time).format('A h:mm:ss')}</span>
if (dayjs(props.time).year() !== dayjs().year()) return <time title={fullday} style={absStyle}>{dayjs(props.time).format('YYYY/M/D A h:mm')}</time>
if (dayjs(props.time).month() !== dayjs().month()) return <time title={fullday} style={absStyle}>{dayjs(props.time).format('M/D A h:mm')}</time>
if (dayjs(props.time).date() !== dayjs().date()) return <time title={fullday} style={absStyle}>{dayjs(props.time).format('M/D A h:mm')}</time>
return <time title={fullday} style={absStyle}>{dayjs(props.time).format('A h:mm:ss')}</time>
}
return (
<time dateTime={dayjs(props.time).format('YYYY-MM-DD HH:mm:ss')} title={fullday} style={props.style} onClick={props.onClick}>
Expand Down

0 comments on commit 98e0c71

Please sign in to comment.