Support Streaks
This commit is contained in:
parent
6668712eff
commit
4134f5ed9c
|
@ -10,10 +10,11 @@ import type { Account } from 'soapbox/schemas/index.ts';
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
||||||
follows: { id: 'account.follows', defaultMessage: 'Following' },
|
follows: { id: 'account.follows', defaultMessage: 'Following' },
|
||||||
|
streak: { id: 'account.streak', defaultMessage: 'Day Streak' },
|
||||||
});
|
});
|
||||||
|
|
||||||
interface IProfileStats {
|
interface IProfileStats {
|
||||||
account: Pick<Account, 'acct' | 'followers_count' | 'following_count'> | undefined;
|
account: Pick<Account, 'acct' | 'followers_count' | 'following_count' | 'ditto'> | undefined;
|
||||||
onClickHandler?: React.MouseEventHandler;
|
onClickHandler?: React.MouseEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +49,17 @@ const ProfileStats: React.FC<IProfileStats> = ({ account, onClickHandler }) => {
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
</NavLink>
|
</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>
|
</HStack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
"account.search_self": "Search your posts",
|
"account.search_self": "Search your posts",
|
||||||
"account.share": "Share @{name}'s profile",
|
"account.share": "Share @{name}'s profile",
|
||||||
"account.show_reblogs": "Show reposts from @{name}",
|
"account.show_reblogs": "Show reposts from @{name}",
|
||||||
|
"account.streak": "Day Streak",
|
||||||
"account.subscribe": "Subscribe to notifications from @{name}",
|
"account.subscribe": "Subscribe to notifications from @{name}",
|
||||||
"account.subscribe.failure": "An error occurred trying to subscribe to this account.",
|
"account.subscribe.failure": "An error occurred trying to subscribe to this account.",
|
||||||
"account.subscribe.success": "You have subscribed 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(''),
|
display_name: z.string().catch(''),
|
||||||
ditto: coerceObject({
|
ditto: coerceObject({
|
||||||
accepts_zaps: z.boolean().catch(false),
|
accepts_zaps: z.boolean().catch(false),
|
||||||
is_registered: z.boolean().catch(false),
|
|
||||||
external_url: z.string().optional().catch(undefined),
|
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),
|
domain: z.string().optional().catch(undefined),
|
||||||
emojis: filteredArray(customEmojiSchema),
|
emojis: filteredArray(customEmojiSchema),
|
||||||
|
|
Loading…
Reference in New Issue