Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Community stats #750

Merged
merged 12 commits into from
Jul 18, 2023
Merged

Community stats #750

merged 12 commits into from
Jul 18, 2023

Conversation

bohn002
Copy link
Contributor

@bohn002 bohn002 commented Jul 18, 2023

PR Creator Checklist

Ensure you've checked the following before submitting your PR:

  • You've discussed making your changes with a member of the dev team per contributing rules in the README
  • Your changes are free of any lint errors
  • Your changes are free of any typescript errors
  • You've tested your changes

Summary

Resolves #670 Adds stats to the Community About page. When a stat gets above or equals 1000, a prettier version of the digit is displayed. So 1,234 is displayed as 1.2k etc.

Screenshots

image
image

Test Plan

Open the feed, select a Community. Click "About". Scroll page down to "Stats".

Copy link
Collaborator

@sgriff96 sgriff96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving comments before merging so you can see @bohn002

<Text fontSize="xl" fontWeight="bold">
Stats:
</Text>
<HStack flexWrap="wrap">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<HStack flexWrap="wrap">
<HStack flexWrap="wrap" space={1}>

Comment on lines +14 to +19
const subscribers = shortenNumber(counts.subscribers);
const posts = shortenNumber(counts.posts);
const comments = shortenNumber(counts.comments);
const usersActiveMonth = shortenNumber(counts.users_active_month);
const usersActiveWeek = shortenNumber(counts.users_active_week);
const usersActiveDay = shortenNumber(counts.users_active_day);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bohn002 we already had this util (but I realized it was broken, so fixed it). Also you named the function (PrettyNumbers) with PascalCase, but non React component functions should be camelCase.

React components - PascalCase
Everything else - camelCase

import AvatarUsername from "./AvatarUsername";

interface IProps {
item: any;
moderators: CommunityModeratorView[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to just pass the moderators list instead of being for 1 item in the list. Also don't use any if you can. It makes it so typescript just doesn't work, which is not actually helpful generally.

@sgriff96 sgriff96 merged commit 1e4f80e into Memmy-App:main Jul 18, 2023
@bohn002 bohn002 deleted the community_stats branch July 19, 2023 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Community Sidebar Enhancements - Community Stats
2 participants