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

Leaderboard component and homepage #78

Merged
merged 33 commits into from
Sep 15, 2024
Merged

Conversation

GODrums
Copy link
Contributor

@GODrums GODrums commented Sep 8, 2024

Motivation

As our first gamfication component, we want to create a rework of the activity leaderboard in Artemis.

Pre-requisits:

Description

This PR adds a simple Artemis leaderboard to the homepage and creates components with corresponding Storybook-Stories.
In the future, it can easily extended with @tanstack/angular-table for filters, sorting, pagination.

Screenshots (if applicable)

image

Checklist

General

  • PR title is clear and descriptive
  • PR description explains the purpose and changes
  • Code follows project coding standards
  • Self-review of the code has been done
  • Changes have been tested locally
  • Screenshots have been attached (if applicable)

Client (if applicable)

  • UI changes look good on all screen sizes and browsers
  • No console errors or warnings
  • User experience and accessibility have been tested
  • Added Storybook stories for new components
  • Components follow design system guidelines (if applicable)

@GODrums GODrums added enhancement New feature or request client needs work PRs that need more work feature labels Sep 8, 2024
@GODrums GODrums added this to the Gamification Leaderboard MVP milestone Sep 8, 2024
@GODrums GODrums self-assigned this Sep 8, 2024
@github-actions github-actions bot added application-server size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 8, 2024
@github-actions github-actions bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 13, 2024
@github-actions github-actions bot removed the size:XXL This PR changes 1000+ lines, ignoring generated files. label Sep 13, 2024
@github-actions github-actions bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 14, 2024
@github-actions github-actions bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 14, 2024
Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich left a comment

Choose a reason for hiding this comment

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

Generally looks good :) We can also do the improvements in a follow-up

import { TableComponent } from 'app/ui/table/table.component';
import { lastValueFrom } from 'rxjs';

const defaultData: LeaderboardEntry[] = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I think the way to do it would be mocking the service for the storybook story somehow.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This data should be part of the story though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can probably just delete this data set as it should only be for testing purposes. And then only display the leaderboard if we are able to fetch data from the server. The story currently uses its own testing data set.

Would that solve the issue for you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean the story fails to fetch the data and then falls back to this data, either remove it here or move it to the story.

const meta: Meta<LeaderboardComponent> = {
title: 'Components/Leaderboard',
component: LeaderboardComponent,
tags: ['autodocs']
Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich Sep 14, 2024

Choose a reason for hiding this comment

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

I think we would somehow inject a provider for a mocked LeaderboardService that returns the mock data here. Alternatively, we would dumb down the leaderboard component into for example LeaderboardComponent or page (smart with service) and LeaderboardTableComponent (dumb no service).

Copy link
Collaborator

Choose a reason for hiding this comment

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

For the icon components we would also want stories. Maybe just a big story with all custom icons 🤔 But we can also do this in a follow-up

@@ -0,0 +1,55 @@
<div class="flex flex-col gap-4 py-8">
<h1 class="text-3xl font-bold">Artemis Leaderboard</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe just have a leaderboard page component that is the smart component and separate out the table, I think this is the way.

We can skip having a story for the smart components for now, there we would need to mock the services in the stories.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now the leaderboard is already basically just a wrapper for the table-component with the required logic it feels like.
I guess we could also just move the heading to the main-component to make the separation more clear?
Is there an advantage to separate components I'm missing here?

Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich Sep 14, 2024

Choose a reason for hiding this comment

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

I'm still thinking about it 🤔 Okay maybe taking a step back this page would be called the home page or the dashboard page which fetches the data from the service(s) using a leaderboard component. But ideally the leaderboard component is dumb and does not require a dependency to a service, because this always makes testing or showing it in the storybook harder.

If we were to add for example some user actions for filtering the timeframe etc. the leaderboard component would have a callback/output/binding to do that but does not smartly also set the filter for the service. Does this make sense?

In the design system /ui the components should be rather generic and reusable. Having a more specialized component building the leaderboard using the code from the design system which also has a story also makes sense to me. I would like to show the leaderboard component in the storybook for documentation but we do not necessarily have to show the whole home page / dashboard page smart component in there too.

Copy link
Contributor Author

@GODrums GODrums Sep 14, 2024

Choose a reason for hiding this comment

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

I think I understand where you are going with that idea now. I personally didn't think about that separation right away because we don't really plan on creating multiple leaderboards rather than one for all repos.

With your explanation I do see the point for it, although I feel like it creates an (unnecessary?) level of abstraction in this use case. Let's further discuss this in our next meeting maybe and rework in a follow-up PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's do it in a follow-up. In my mind the leaderboard is just one component on the page. We will add more gamification elements on the same page but you are also right that we might create a leaderboard route per repo in the near future 🤔

@github-actions github-actions bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 14, 2024
Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich left a comment

Choose a reason for hiding this comment

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

LGTM

@FelixTJDietrich FelixTJDietrich merged commit eef2dfa into develop Sep 15, 2024
5 checks passed
@FelixTJDietrich FelixTJDietrich deleted the feature/leaderboard-page branch September 15, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application-server client enhancement New feature or request feature needs work PRs that need more work size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants