mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-28 14:20:46 -05:00
Rename suggestion.info -> suggestedUser
This commit is contained in:
@@ -59,8 +59,7 @@ const findVisibleForUserStm = sql.prepare(`
|
||||
`);
|
||||
|
||||
export interface FindVisibleForUserSuggestedUserInfo {
|
||||
// xxx: rename suggestedUser or something
|
||||
info: Pick<
|
||||
suggestedUser: Pick<
|
||||
User,
|
||||
| "id"
|
||||
| "discordId"
|
||||
@@ -105,14 +104,14 @@ function mapFindVisibleForUserRowsToResult(rows: any[]): FindVisibleForUser {
|
||||
};
|
||||
|
||||
const existingSuggestion = result[row.tier].find(
|
||||
(suggestion) => suggestion.info.id === row.suggestedId
|
||||
(suggestion) => suggestion.suggestedUser.id === row.suggestedId
|
||||
);
|
||||
|
||||
if (existingSuggestion) {
|
||||
existingSuggestion.suggestions.push(suggestionInfo);
|
||||
} else {
|
||||
result[row.tier].push({
|
||||
info: {
|
||||
suggestedUser: {
|
||||
id: row.suggestedId,
|
||||
discordId: row.suggestedDiscordId,
|
||||
discordName: row.suggestedDiscordName,
|
||||
|
||||
@@ -75,7 +75,7 @@ function alreadyCommentedByUser({
|
||||
}: CanAddCommentToSuggestionArgs) {
|
||||
return Boolean(
|
||||
suggestions[targetPlusTier]
|
||||
?.find((u) => u.info.id === suggested.id)
|
||||
?.find((u) => u.suggestedUser.id === suggested.id)
|
||||
?.suggestions.some((s) => s.author.id === user?.id)
|
||||
);
|
||||
}
|
||||
@@ -89,7 +89,9 @@ export function playerAlreadySuggested({
|
||||
"suggestions" | "suggested" | "targetPlusTier"
|
||||
>) {
|
||||
return Boolean(
|
||||
suggestions[targetPlusTier]?.find((u) => u.info.id === suggested.id)
|
||||
suggestions[targetPlusTier]?.find(
|
||||
(u) => u.suggestedUser.id === suggested.id
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ export default function PlusSuggestionsPage() {
|
||||
<div className="stack lg">
|
||||
{visibleSuggestions.map((u) => (
|
||||
<SuggestedUser
|
||||
key={`${u.info.id}-${tierVisible}`}
|
||||
key={`${u.suggestedUser.id}-${tierVisible}`}
|
||||
suggested={u}
|
||||
tier={tierVisible}
|
||||
/>
|
||||
@@ -229,16 +229,16 @@ function SuggestedUser({
|
||||
<div className="stack md">
|
||||
<div className="plus__suggested-user-info">
|
||||
<Avatar
|
||||
discordAvatar={suggested.info.discordAvatar}
|
||||
discordId={suggested.info.discordId}
|
||||
discordAvatar={suggested.suggestedUser.discordAvatar}
|
||||
discordId={suggested.suggestedUser.discordId}
|
||||
size="md"
|
||||
/>
|
||||
{/* xxx: can cause page to overflow when long e.g. Buckinghamshire */}
|
||||
<h2>{suggested.info.discordName}</h2>
|
||||
<h2>{suggested.suggestedUser.discordName}</h2>
|
||||
{canAddCommentToSuggestionFE({
|
||||
user,
|
||||
suggestions: data.suggestions,
|
||||
suggested: { id: suggested.info.id },
|
||||
suggested: { id: suggested.suggestedUser.id },
|
||||
targetPlusTier: Number(tier),
|
||||
}) ? (
|
||||
// TODO: resetScroll={false} https://twitter.com/ryanflorence/status/1527775882797907969
|
||||
@@ -246,7 +246,7 @@ function SuggestedUser({
|
||||
className="plus__comment-button"
|
||||
tiny
|
||||
variant="outlined"
|
||||
to={`comment/${tier}/${suggested.info.id}`}
|
||||
to={`comment/${tier}/${suggested.suggestedUser.id}`}
|
||||
data-cy="comment-button"
|
||||
>
|
||||
Comment
|
||||
@@ -284,7 +284,7 @@ function SuggestedUser({
|
||||
<CommentDeleteButton
|
||||
suggestionId={suggestion.id}
|
||||
tier={tier}
|
||||
suggestedDiscordName={suggested.info.discordName}
|
||||
suggestedDiscordName={suggested.suggestedUser.discordName}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -66,7 +66,7 @@ export default function PlusCommentModalPage() {
|
||||
const tierSuggestedTo = String(params.tier);
|
||||
|
||||
const userBeingCommented = data.suggestions?.[tierSuggestedTo]?.find(
|
||||
(u) => u.info.id === targetUserId
|
||||
(u) => u.suggestedUser.id === targetUserId
|
||||
);
|
||||
|
||||
if (
|
||||
@@ -88,8 +88,8 @@ export default function PlusCommentModalPage() {
|
||||
<input type="hidden" name="tier" value={tierSuggestedTo} />
|
||||
<input type="hidden" name="suggestedId" value={targetUserId} />
|
||||
<h2 className="plus__modal-title">
|
||||
{userBeingCommented.info.discordName}'s +{tierSuggestedTo}{" "}
|
||||
suggestion
|
||||
{userBeingCommented.suggestedUser.discordName}'s +
|
||||
{tierSuggestedTo} suggestion
|
||||
</h2>
|
||||
<CommentTextarea />
|
||||
<div className="plus__modal-buttons">
|
||||
|
||||
Reference in New Issue
Block a user