Skip to content

Commit c0089d8

Browse files
authored
fix: mf-6493 add missing location (#11940)
* fix: mf-6493 add missing location * fix: mf-6495 space between texts * fixup! fix: mf-6493 add missing location
1 parent 15cf698 commit c0089d8

File tree

14 files changed

+144
-83
lines changed

14 files changed

+144
-83
lines changed

packages/icons/general/CalendarDark.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Loading

packages/icons/icon-generated-as-jsx.js

Lines changed: 25 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/icons/icon-generated-as-url.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mask/dashboard/components/OnboardingWriter/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ export function OnboardingWriter({ words, ...props }: OnboardingWriterProps) {
8080
: undefined,
8181
),
8282
}
83-
if (take < text.length) newJsx.push(cloneElement(fragment, props, [text.slice(0, take)]))
83+
// the trailing space gets trimmed by i18n marco
84+
if (take <= text.length) newJsx.push(cloneElement(fragment, props, [text.slice(0, take)]))
8485
else
8586
newJsx.push(
8687
cloneElement(fragment, props, [
8788
text,
88-
<strong key={size}>{strongText.slice(0, take - text.length)}</strong>,
89+
<strong key={size}> {strongText.slice(0, take - text.length)}</strong>,
8990
]),
9091
)
9192
}

packages/plugins/Calendar/src/SiteAdaptor/CalendarContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface Props extends HTMLProps<HTMLDivElement> {
4545
export function CalendarContent(props: Props) {
4646
const { classes, cx } = useStyles()
4747
const [currentTab, onChange, tabs] = useTabs('news', 'events')
48-
const [date, setDate] = useState(() => new Date())
48+
const [date, setDate] = useState(() => new Date(Math.floor(Date.now() / 1000) * 1000)) // round to seconds
4949
const [open, setOpen] = useState(false)
5050

5151
const [allowedDates, setAllowedDates] = useState<string[]>(EMPTY_LIST)

packages/plugins/Calendar/src/SiteAdaptor/components/EventList.tsx

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Trans } from '@lingui/macro'
2-
import { ElementAnchor, EmptyStatus, Image, LoadingStatus } from '@masknet/shared'
2+
import { ElementAnchor, EmptyStatus, Image, LoadingStatus, ReloadStatus } from '@masknet/shared'
33
import { EMPTY_LIST } from '@masknet/shared-base'
44
import { LoadingBase, makeStyles } from '@masknet/theme'
55
import { resolveIPFS_URL } from '@masknet/web3-shared-base'
@@ -9,6 +9,7 @@ import { uniq } from 'lodash-es'
99
import { useEffect, useMemo } from 'react'
1010
import { useLumaEvents } from '../../hooks/useLumaEvents.js'
1111
import { ImageLoader } from './ImageLoader.js'
12+
import { Icons } from '@masknet/icons'
1213

1314
const useStyles = makeStyles()((theme) => ({
1415
container: {
@@ -75,20 +76,16 @@ const useStyles = makeStyles()((theme) => ({
7576
fontSize: '14px',
7677
fontWeight: 400,
7778
lineHeight: '18px',
78-
color: theme.palette.mode === 'dark' ? theme.palette.maskColor.second : theme.palette.maskColor.main,
79+
color: theme.palette.maskColor.main,
7980
},
80-
time: {
81-
fontSize: '14px',
81+
info: {
82+
fontSize: '13px',
8283
fontWeight: 400,
8384
lineHeight: '18px',
84-
color: theme.palette.maskColor.second,
85-
},
86-
dateDiv: {
87-
fontSize: '14px',
88-
fontWeight: 700,
89-
lineHeight: '18px',
9085
color: theme.palette.maskColor.main,
91-
padding: '10px 0',
86+
display: 'flex',
87+
gap: theme.spacing(1.5),
88+
alignItems: 'center',
9289
},
9390
loading: {
9491
color: theme.palette.maskColor.main,
@@ -102,7 +99,7 @@ interface EventListProps {
10299

103100
export function EventList({ date, onDatesUpdate }: EventListProps) {
104101
const { classes, cx } = useStyles()
105-
const { isLoading, isFetching, data, hasNextPage, fetchNextPage } = useLumaEvents()
102+
const { isLoading, isFetching, data, error, hasNextPage, fetchNextPage } = useLumaEvents(date)
106103

107104
const comingEvents = useMemo(() => {
108105
if (!data) return EMPTY_LIST
@@ -125,6 +122,18 @@ export function EventList({ date, onDatesUpdate }: EventListProps) {
125122
</div>
126123
)
127124
}
125+
126+
if (error) {
127+
return (
128+
<div className={classes.container}>
129+
<div className={classes.paddingWrap}>
130+
<div className={cx(classes.empty, classes.eventTitle)}>
131+
<ReloadStatus message={error.message}></ReloadStatus>
132+
</div>
133+
</div>
134+
</div>
135+
)
136+
}
128137
if (!comingEvents.length) {
129138
return (
130139
<div className={classes.container}>
@@ -142,35 +151,38 @@ export function EventList({ date, onDatesUpdate }: EventListProps) {
142151
return (
143152
<div className={classes.container}>
144153
<div className={classes.paddingWrap}>
145-
{comingEvents.map((entry) => {
154+
{comingEvents.map((event) => {
146155
return (
147-
<div key={entry.event_id}>
148-
<Typography className={classes.dateDiv}>
149-
{format(new Date(entry.event_date), 'MMM dd,yyy')}
150-
</Typography>
151-
<Link
152-
className={classes.eventCard}
153-
href={entry.event_url}
154-
rel="noopener noreferrer"
155-
target="_blank">
156-
<div className={classes.eventHeader}>
157-
<div className={classes.projectWrap}>
158-
<Image
159-
src={resolveIPFS_URL(entry.poster_url)}
160-
classes={{ container: classes.logo }}
161-
size={24}
162-
alt={entry.event_title}
163-
/>
164-
<Typography className={classes.projectName}>{entry.event_title}</Typography>
165-
</div>
156+
<Link
157+
key={event.event_id}
158+
className={classes.eventCard}
159+
href={event.event_url}
160+
rel="noopener noreferrer"
161+
target="_blank">
162+
<div className={classes.eventHeader}>
163+
<div className={classes.projectWrap}>
164+
<Image
165+
src={resolveIPFS_URL(event.poster_url)}
166+
classes={{ container: classes.logo }}
167+
size={24}
168+
alt={event.event_title}
169+
/>
170+
<Typography className={classes.projectName}>{event.event_title}</Typography>
166171
</div>
167-
<Typography className={classes.eventTitle}>{entry.event_title}</Typography>
168-
<Typography className={classes.time}>
169-
{format(new Date(entry.event_date), 'MMM dd, yyyy HH:mm')}
172+
</div>
173+
<Typography className={classes.eventTitle}>{event.event_title}</Typography>
174+
{event.event_full_location ?
175+
<Typography className={classes.info}>
176+
<Icons.Location size={18} />
177+
{event.event_full_location}
170178
</Typography>
171-
<ImageLoader src={entry.poster_url} />
172-
</Link>
173-
</div>
179+
: null}
180+
<Typography className={classes.info}>
181+
<Icons.LinearCalendar size={18} />
182+
{format(event.event_date, 'MMM dd, yyyy HH:mm')}
183+
</Typography>
184+
<ImageLoader src={event.poster_url} />
185+
</Link>
174186
)
175187
})}
176188
{hasNextPage ?

packages/plugins/Calendar/src/SiteAdaptor/components/Footer.tsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ const useStyles = makeStyles()((theme) => ({
4949
lineHeight: '20px',
5050
alignItems: 'center',
5151
},
52-
providerName: {
53-
color: theme.palette.maskColor.main,
54-
fontSize: '14px',
55-
fontWeight: 700,
56-
lineHeight: '18px',
57-
alignItems: 'center',
58-
},
5952
}))
6053

6154
export interface FooterProps {
@@ -65,18 +58,8 @@ export interface FooterProps {
6558
export function Footer({ tab }: FooterProps) {
6659
const { classes } = useStyles()
6760
const providerMap = {
68-
news: (
69-
<>
70-
<Typography className={classes.providerName}>CoinCarp</Typography>
71-
<Icons.CoinCarp size={24} />
72-
</>
73-
),
74-
events: (
75-
<>
76-
<Typography className={classes.providerName}></Typography>
77-
<Icons.Luma size={24} />
78-
</>
79-
),
61+
news: <Icons.CoinCarp size={24} />,
62+
events: <Icons.Luma size={24} />,
8063
} as const
8164
const openApplicationBoardDialog = useOpenApplicationSettings()
8265
return (

packages/plugins/Calendar/src/SiteAdaptor/components/NewsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ interface NewsListProps {
110110
}
111111

112112
export function NewsList({ date, onDatesUpdate }: NewsListProps) {
113-
const { data: list = EMPTY_OBJECT, isLoading } = useNewsList(date, true)
113+
const { data: list = EMPTY_OBJECT, isLoading } = useNewsList(date)
114114
const dateString = date.toLocaleDateString()
115115
const empty = !Object.keys(list).length
116116
const { classes, cx } = useStyles()

packages/plugins/Calendar/src/hooks/useEventList.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import type { ParsedEvent } from '@masknet/web3-providers/types'
44
import { useQuery } from '@tanstack/react-query'
55
import { addDays, startOfMonth } from 'date-fns'
66

7-
export function useNewsList(date: Date, enabled = true) {
8-
const startTime = startOfMonth(date).getTime() / 1000
9-
const endTime = Math.floor(addDays(date, 45).getTime() / 1000)
7+
export function useNewsList(date: Date) {
8+
const startTime = startOfMonth(date).getTime()
9+
const endTime = addDays(date, 45).getTime()
1010
return useQuery({
11-
enabled,
1211
queryKey: ['newsList', startTime, endTime],
1312
queryFn: async () => Calendar.getNewsList(startTime, endTime),
1413
select(data) {

0 commit comments

Comments
 (0)