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

[#8652] Kiez Profile List View #5894

Merged
merged 2 commits into from
Jan 8, 2025
Merged

[#8652] Kiez Profile List View #5894

merged 2 commits into from
Jan 8, 2025

Conversation

sevfurneaux
Copy link
Collaborator

@sevfurneaux sevfurneaux commented Dec 17, 2024

Describe your changes
This PR adds the Kiez profile list view.

2024-12-18 12 33 28

Tasks

  • PR name contains story or task reference
  • Steps to recreate and test the changes
  • Documentation (docs and inline)
  • Tests (including n+1 and django_assert_num_queries where applicable)
  • Changelog

@sevfurneaux sevfurneaux self-assigned this Dec 17, 2024
@sevfurneaux sevfurneaux force-pushed the sf-2024-12-kiez-search-profile branch from e2d7d3b to 397de51 Compare December 18, 2024 12:32
@sevfurneaux sevfurneaux changed the title [WIP] [#8652] Kiez Profile List View [#8652] Kiez Profile List View Dec 18, 2024
@sevfurneaux sevfurneaux force-pushed the sf-2024-12-kiez-search-profile branch from 397de51 to d40b319 Compare December 18, 2024 12:38
@sevfurneaux sevfurneaux force-pushed the sf-2024-12-kiez-search-profile branch 2 times, most recently from 7aad134 to de6a04c Compare December 19, 2024 13:10
@vellip vellip force-pushed the sf-2024-12-kiez-search-profile branch from de6a04c to 278dcee Compare January 7, 2025 06:36
Copy link
Collaborator

@vellip vellip left a comment

Choose a reason for hiding this comment

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

Thank you for your implementation! I left a few change requests, but looks good overall.

display: inline-block;
text-align: center;
cursor: pointer;
color: var(--color-black);
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 we use sass variables here. $text-base if i remember correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

$text-base is now added 👍

Comment on lines 37 to 45
export default function SearchProfiles (props) {
return (
<>
<h1>{titleText}</h1>
<p>{descriptionText}</p>
<SearchProfileList {...props} />
</>
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

split components into separate files please

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All components now split 👍

return (
<div className="search-profile">
<div className="search-profile__header">
<h3 className="search-profile__title">{profile.name}</h3>
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should also show what filters have been set, no?
CleanShot 2025-01-07 at 07 29 19@2x

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, this is now added. I'll add the toggle below the filters in a future PR.

}

.search-profile__button:hover,
.search-profile__button:focus {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would skip the focus style as that normally already has the focus-highlight ring. We don't underline links on focus anywhere else on the page, normally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

.search-profile__button:focus is now removed.

Comment on lines 99 to 102
left: 0;
right: 0;
pointer-events: none;
position: fixed;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest we keep the normal alertlayout, as it's more consistent to the user that way. afaik regular alerts are not fixed but in document flow

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now using the normal alert classes 👍

Comment on lines 103 to 105
<h2 className="search-profiles-list__title">
{yourSavedProfilesText} ({searchProfiles.length})
</h2>
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can keep both the h2s in each of the cases (length === 0 // length !== 0) below the alert and just change the text inside the h2 based on the case and then skip the React.Fragments (<>)

Copy link
Collaborator Author

@sevfurneaux sevfurneaux Jan 7, 2025

Choose a reason for hiding this comment

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

<h2> moved and fragment removed 👍

Comment on lines 162 to 169
const response = await fetch(apiUrl + profile.id + '/', {
headers: {
'Content-Type': 'application/json; charset=utf-8',
'X-CSRFToken': cookie.get('csrftoken')
},
method: 'PATCH',
body: JSON.stringify({ name: e.target.elements.name.value })
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use updateItem for this i gather.

export function updateItem (data, url, method) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added updateItem 👍

)
}

function Buttons ({ onEdit, onDelete, loading }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you give this some more descriptive name after you split the components into separate files? Otherwise this would probably show up for a lot of autocompletes in IDE

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed to SearchProfileButtons

)
}

function Alert ({ onClose }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you re-use node-modules/adhocracy4/static/Alert.jsx? (path might not be 100% exact)

Copy link
Collaborator Author

@sevfurneaux sevfurneaux Jan 7, 2025

Choose a reason for hiding this comment

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

I attempted to add this:

import Alert from 'adhocracy4/adhocracy4/static/Alert'

and

<Alert
  type="success"
  message={alertHeadlineText}
  onClick={() => setAlert(false)}
/>

But this component looks outdated. It doesn't use the the latest alert classes such as alert__content, alert__headline and alert__text.

It is also not possible to pass in both a headline and text prop, and only a singular message.

I've kept my SearchProfileAlert for now, but maybe we could resolve the above in a PR and add a ticket to make Alert up-to-date?

@sevfurneaux
Copy link
Collaborator Author

sevfurneaux commented Jan 7, 2025

Thank you for your implementation! I left a few change requests, but looks good overall.

@vellip Happy New Year! Thanks for the feedback, will take a look now 👀

@sevfurneaux sevfurneaux requested a review from vellip January 7, 2025 16:05
Copy link
Collaborator

@vellip vellip left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@vellip vellip merged commit 1b5e0d6 into dev Jan 8, 2025
3 checks passed
@vellip vellip deleted the sf-2024-12-kiez-search-profile branch January 8, 2025 08:05
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.

2 participants