Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Feat: admin page (history) #78

Merged
merged 20 commits into from
Aug 6, 2024
Merged

Feat: admin page (history) #78

merged 20 commits into from
Aug 6, 2024

Conversation

hetd54
Copy link
Collaborator

@hetd54 hetd54 commented Aug 1, 2024

Goal: Adds a page for any administrators to view WHO has downloaded the data

Screenshot 2024-08-01 at 10 14 14 AM

login is limited by users who are explicitly in the admin firestore collection:
https://console.firebase.google.com/project/mmp-site-b1c9b/firestore/databases/-default-/data/~2Fadmin~2FQiYKGn6GU071d6MuDYBH

Questions for Reviewers

/admin is taken by staticCMS, so I am proposing /history (although I am not in love with it. any ideas?)

We could take advantage of astro's islands feature here by using atoms: https://docs.astro.build/en/recipes/sharing-state-islands/ not sure if performance would be a concern here?

We need to ask David how far back he wants the data. We can ask @anna-murphy for help here if we need firestore filtering.

@hetd54 hetd54 requested a review from galenwinsor August 1, 2024 13:40
Copy link

github-actions bot commented Aug 1, 2024

Visit the preview URL for this PR (updated for commit 2bf4512):

https://mmp-site-b1c9b--pr78-feat-admin-page-tkddljmx.web.app

(expires Tue, 13 Aug 2024 17:48:12 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4eb870c89e876f1812e204af417359065d2a23b1

Copy link
Collaborator

@anna-murphy anna-murphy left a comment

Choose a reason for hiding this comment

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

Looks pretty good! I'm curious how the islands felt in practice, but it looks really clean. In terms of name, I don't mind "history", but I could also see "activity" being okay?

src/components/HistoryPage.tsx Outdated Show resolved Hide resolved
Comment on lines 20 to 24
<th>Name</th>
<th>Institution</th>
<th>Email</th>
<th>Description</th>
<th>Download Date</th>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there might be a way to remove this... I don't like tables as UI elements, so feel free to ignore this, but I wonder if you could write each row as a list item formatted something like this?

This doesn't include the description, but I'm not certain what you were envisioning there. Just some food for thought! Feel free to ignore this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@anna-murphy can you expand on this? I'm pretty sure tables are best practice for accessibility when you have multi-dimensional data.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'm wondering if the data is really multi-dimensional. If that's not a useful suggestion I can rescind it though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking about this quite a bit -- the most important feature for David (I think) is for him to be able to get all the emails of the users who have downloaded the data. My thought is to just ask David, but he has indicated a preference for mirroring UI of the old site, which is why leaving it as a table may be preferred.

I fully agree with the non-table preference, but this table will likely be 1-5 rows total.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure how Astro handles this, but can these be moved to secrets somewhere? I feel like we don't want to keep this info so visible if we can avoid it, you know? But maybe Astro obfuscates that enough.

src/firebase.js Outdated
const db = getFirestore(app)
export const auth = getAuth(app)

export const addHistoryData = async (inputs) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this called? I don't see it in the changelog at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR is meant to be added AFTER #77 , where this is introduced.

src/firebase.js Outdated Show resolved Hide resolved
@galenwinsor
Copy link
Contributor

galenwinsor commented Aug 5, 2024

Things:

  • Make login and logout verbs: "Log in" and "Log out"
  • "Number of downloads: 1" -> "1 downloads"
  • Perhaps three columns for table? Description, user, date?
  • Remove "This page is only for admins" on error
  • Show "you are not an admin" as an error (highlighted in red)

@hetd54
Copy link
Collaborator Author

hetd54 commented Aug 5, 2024

New error

Screenshot 2024-08-05 at 11 34 47 AM

Note: not pictured here is that I also added David's email to the error message

New Table

Screenshot 2024-08-05 at 11 36 14 AM

Tested with description being 300 characters. Description cell height expands to fit.

Copy link
Contributor

@galenwinsor galenwinsor left a comment

Choose a reason for hiding this comment

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

One final thing: can you align text in the table to the top of the row in each cell?

@hetd54 hetd54 requested a review from galenwinsor August 6, 2024 17:44
@hetd54 hetd54 merged commit 1ca9a3a into main Aug 6, 2024
2 checks passed
@hetd54 hetd54 deleted the feat-admin-page branch August 6, 2024 19:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants