Merge branch 'streaks' into 'main'
Support Streaks See merge request soapbox-pub/soapbox!3327
This commit is contained in:
commit
5fa10f4e58
|
@ -10,10 +10,11 @@ import type { Account } from 'soapbox/schemas/index.ts';
|
|||
const messages = defineMessages({
|
||||
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
||||
follows: { id: 'account.follows', defaultMessage: 'Following' },
|
||||
streak: { id: 'account.streak', defaultMessage: 'Day Streak' },
|
||||
});
|
||||
|
||||
interface IProfileStats {
|
||||
account: Pick<Account, 'acct' | 'followers_count' | 'following_count'> | undefined;
|
||||
account: Pick<Account, 'acct' | 'followers_count' | 'following_count' | 'ditto'> | undefined;
|
||||
onClickHandler?: React.MouseEventHandler;
|
||||
}
|
||||
|
||||
|
@ -48,6 +49,17 @@ const ProfileStats: React.FC<IProfileStats> = ({ account, onClickHandler }) => {
|
|||
</Text>
|
||||
</HStack>
|
||||
</NavLink>
|
||||
|
||||
{account.ditto.streak.days > 0 && (
|
||||
<HStack alignItems='center' space={1}>
|
||||
<Text theme='primary' weight='bold' size='sm'>
|
||||
{shortNumberFormat(account.ditto.streak.days)}
|
||||
</Text>
|
||||
<Text weight='bold' size='sm'>
|
||||
{intl.formatMessage(messages.streak)}
|
||||
</Text>
|
||||
</HStack>
|
||||
)}
|
||||
</HStack>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
"account.search_self": "Search your posts",
|
||||
"account.share": "Share @{name}'s profile",
|
||||
"account.show_reblogs": "Show reposts from @{name}",
|
||||
"account.streak": "Day Streak",
|
||||
"account.subscribe": "Subscribe to notifications from @{name}",
|
||||
"account.subscribe.failure": "An error occurred trying to subscribe to this account.",
|
||||
"account.subscribe.success": "You have subscribed to this account.",
|
||||
|
|
|
@ -38,8 +38,12 @@ const baseAccountSchema = z.object({
|
|||
display_name: z.string().catch(''),
|
||||
ditto: coerceObject({
|
||||
accepts_zaps: z.boolean().catch(false),
|
||||
is_registered: z.boolean().catch(false),
|
||||
external_url: z.string().optional().catch(undefined),
|
||||
streak: coerceObject({
|
||||
days: z.number().catch(0),
|
||||
start: z.string().datetime().nullable().catch(null),
|
||||
end: z.string().datetime().nullable().catch(null),
|
||||
}),
|
||||
}),
|
||||
domain: z.string().optional().catch(undefined),
|
||||
emojis: filteredArray(customEmojiSchema),
|
||||
|
|
Loading…
Reference in New Issue