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

[UI] Refactor Banks Page #1652

Merged
merged 2 commits into from
Oct 6, 2024
Merged

Conversation

deannaflare
Copy link
Contributor

@deannaflare deannaflare commented Oct 3, 2024

Summary

This PR refactors the bank grid page, match form, create bank form, and add content form

  • the banks are now listed in a table instead of a grid of cards
  • The Match Form is now in a card with different styling
  • the Add new bank form is now in a modal
  • the add content form is now in a modal that is triggered by a button per item in the table (there is also now a success state for it)

Test Plan

  • create a new bank and verify that it adds like expected
  • add content to banks and verify that you see a success state as expected with a hash value returned
  • Search by that same content and verify that you see the matches you expect (matches will highlight in the table)

Screenshots:

Screenshot 2024-10-04 at 9 19 32 AM Screenshot 2024-10-04 at 9 09 38 AM Screenshot 2024-10-04 at 9 10 05 AM Screenshot 2024-10-04 at 9 10 19 AM Screenshot 2024-10-04 at 9 10 33 AM

@deannaflare
Copy link
Contributor Author

deannaflare commented Oct 3, 2024

Buggy, ugly code but I'm going to the pub

here's a start

EDIT: it's ready for a review!

@deannaflare deannaflare marked this pull request as ready for review October 4, 2024 08:19
@deannaflare deannaflare changed the title refactor-bank-grid Refactor Banks Page Oct 4, 2024
Comment on lines +3 to +8
<p class="text-secondary">Banks are like folders. You can do the following on this page:</p>
<ul class="text-secondary">
<li>Create new banks</li>
<li>Add content: Add content to each bank</li>
<li>Search by content: Find banks that contain a certain piece of content</li>
</ul>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this up lol. Someone should come up with better copy to describe these concepts.

I think all the pages should have a h1 title and a description

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, and was tempted to give you and @levi-cloudflare a nudge in that direction. I'm fine to land-and-iterate on the content.

Why I agree:

  • The primary purpose of the UI should be to help a non-technical person understand what HMA is doing for showcase demos. We assume anyone using it "for real" will only use the API
  • Therefore, the UI should primarily focus on introducing concepts (e.g. "Bank" terminology.

const highlightMatchedResults = (result) => {
// Render matched banks
result.banks.forEach((bankName) => {
document.getElementById(`bank_item_${bankName}`).classList.add("bg-light");
Copy link
Contributor Author

@deannaflare deannaflare Oct 4, 2024

Choose a reason for hiding this comment

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

I wish this was a darker highlight, but I don't want to mess around with adding custom colors to this and the other provided boostrap colors are ugly in this context lol. I'll leave it up to ya'll

@deannaflare deannaflare changed the title Refactor Banks Page [UI] Refactor Banks Page Oct 4, 2024
Comment on lines +23 to +32
<tr id="bank_item_{{bank['name']}}">
<th scope="row" style="background-color: transparent;">{{ loop.index }}</th>
<td style="background-color: transparent;">{{ bank['name'] }}</td>
<td style="background-color: transparent;">{{ bank['matching_enabled_ratio'] }}</td>
<td style="background-color: transparent;">
{% with bank_title=bank['name'] %}
{% include 'components/banks/add_to_bank_form.html.j2' %}
{% endwith %}
</td>
</tr>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eventually, these will link to their own page with stats and such.

Leaving that up to ya'll too

@@ -0,0 +1,37 @@
{# Copyright (c) Meta Platforms, Inc. and affiliates. #}
<button type="button" class="btn btn-light" data-bs-toggle="modal" data-bs-target="#{{bank_title}}">Add content</button>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish this was an icon and not "Add content" but I didn't want to mess around with icon libraries either lol

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree - we want to keep things as simple as possible, which sometimes means that things may look a little odd because we are trading off against adding more dependencies or custom styling.

Copy link
Contributor

@Dcallies Dcallies left a comment

Choose a reason for hiding this comment

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

We usually break something with these UI restyles, but it's labor intensive to click on everything, and it looks like you did all the tests I would have run. Let's land-and-iterate.

Comment on lines +3 to +8
<p class="text-secondary">Banks are like folders. You can do the following on this page:</p>
<ul class="text-secondary">
<li>Create new banks</li>
<li>Add content: Add content to each bank</li>
<li>Search by content: Find banks that contain a certain piece of content</li>
</ul>
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, and was tempted to give you and @levi-cloudflare a nudge in that direction. I'm fine to land-and-iterate on the content.

Why I agree:

  • The primary purpose of the UI should be to help a non-technical person understand what HMA is doing for showcase demos. We assume anyone using it "for real" will only use the API
  • Therefore, the UI should primarily focus on introducing concepts (e.g. "Bank" terminology.

@@ -0,0 +1,37 @@
{# Copyright (c) Meta Platforms, Inc. and affiliates. #}
<button type="button" class="btn btn-light" data-bs-toggle="modal" data-bs-target="#{{bank_title}}">Add content</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree - we want to keep things as simple as possible, which sometimes means that things may look a little odd because we are trading off against adding more dependencies or custom styling.

@Dcallies Dcallies merged commit 403308b into facebook:main Oct 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants