Skip to content

Conversation

@mvolkmann
Copy link
Collaborator

No description provided.

@mvolkmann mvolkmann marked this pull request as draft April 26, 2024 20:11
@@ -1,60 +0,0 @@
import React, { useContext, useState } from 'react';
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 is a very small component that is only used in GridResults.jsx which needed feedback from this.
It seemed easiest to just move the functionality into GridResults.jsx than to add more props to communicate.

@@ -1,39 +0,0 @@
import React from 'react';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The component this tests was deleted, so this test file was deleted.

? editedGuild.guildMembers.filter(guildMember => guildMember.lead)
: []
}
isOptionEqualToValue={(option, value) =>
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 prop was missing and I think it is required to compare options to the selected value, just like it is used in the next AutoComplete.

getOptionLabel={option => option.name}
isOptionEqualToValue={(option, value) =>
value ? value.id === option.id : false
value && option.id === value.memberId
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'm pretty sure we want to compare against the memberId property in the value object rather than the id property.

@@ -1,13 +1,17 @@
import React, { useContext, useState } from 'react';
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 reordered some of the imports.

import AddGuildModal from './EditGuildModal';
import GuildSummaryCard from './GuildSummaryCard';
import SkeletonLoader from '../skeleton_loader/SkeletonLoader';
import { useQueryParameters } from '../../helpers/query-parameters';
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 is a new import.

setSearchText(e.target.value);
}}
/>
<GuildsActions />
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 GuildActions component was very small and only used here. To simplify communication between that code and this code, I copied the code into here and deleted that component.

const GuildSummaryCard = ({ guild, index, isOpen, onGuildSelect }) => {
const { state, dispatch } = useContext(AppContext);
const { guilds, userProfile, csrf } = state;
const [open, setOpen] = useState(false);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The default value of this state is now passed in a prop.

const handleClose = () => setOpen(false);
const handleOpen = () => {
setOpen(true);
onGuildSelect(guild.id);
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 is necessary to inform the parent component of the change.

};
const handleClose = () => {
setOpen(false);
onGuildSelect('');
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 is necessary to inform the parent component of the change.

const { dispatch, state } = useContext(AppContext);
const { csrf, guilds, userProfile } = state;
const [addOpen, setAddOpen] = useState(false);
const [openedGuildId, setOpenedGuildId] = useState('');
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 maintains state used by GuildSummaryCard.

@mvolkmann mvolkmann marked this pull request as ready for review April 29, 2024 19:53
@mvolkmann mvolkmann merged commit 52fc35b into develop Apr 29, 2024
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.

4 participants