Dismiss the avatar menu after selecting "Update Signal"

This commit is contained in:
Jordan Rose 2023-05-17 10:50:47 -07:00 committed by GitHub
parent 6e5d9f5dd8
commit 2ee15cdfa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -45,12 +45,12 @@ const useProps = (overrideProps: Partial<Props> = {}): Props => ({
isMe: true, isMe: true,
noteToSelf: boolean('noteToSelf', overrideProps.noteToSelf || false), noteToSelf: boolean('noteToSelf', overrideProps.noteToSelf || false),
onEditProfile: action('onEditProfile'), onEditProfile: action('onEditProfile'),
onStartUpdate: action('startUpdate'),
onViewArchive: action('onViewArchive'), onViewArchive: action('onViewArchive'),
onViewPreferences: action('onViewPreferences'), onViewPreferences: action('onViewPreferences'),
phoneNumber: text('phoneNumber', overrideProps.phoneNumber || ''), phoneNumber: text('phoneNumber', overrideProps.phoneNumber || ''),
profileName: text('profileName', overrideProps.profileName || ''), profileName: text('profileName', overrideProps.profileName || ''),
sharedGroupNames: [], sharedGroupNames: [],
startUpdate: action('startUpdate'),
style: {}, style: {},
theme: React.useContext(StorybookThemeContext), theme: React.useContext(StorybookThemeContext),
title: text('title', overrideProps.title || ''), title: text('title', overrideProps.title || ''),

View file

@ -16,9 +16,9 @@ export type Props = {
readonly theme: ThemeType; readonly theme: ThemeType;
hasPendingUpdate: boolean; hasPendingUpdate: boolean;
startUpdate: () => unknown;
onEditProfile: () => unknown; onEditProfile: () => unknown;
onStartUpdate: () => unknown;
onViewPreferences: () => unknown; onViewPreferences: () => unknown;
onViewArchive: () => unknown; onViewArchive: () => unknown;
@ -34,11 +34,11 @@ export function AvatarPopup(props: Props): JSX.Element {
i18n, i18n,
name, name,
onEditProfile, onEditProfile,
onStartUpdate,
onViewArchive, onViewArchive,
onViewPreferences, onViewPreferences,
phoneNumber, phoneNumber,
profileName, profileName,
startUpdate,
style, style,
title, title,
} = props; } = props;
@ -105,7 +105,7 @@ export function AvatarPopup(props: Props): JSX.Element {
<button <button
type="button" type="button"
className="module-avatar-popup__item" className="module-avatar-popup__item"
onClick={startUpdate} onClick={onStartUpdate}
> >
<div <div
className={classNames( className={classNames(

View file

@ -173,13 +173,16 @@ export function MainHeader({
title={title} title={title}
avatarPath={avatarPath} avatarPath={avatarPath}
hasPendingUpdate={hasPendingUpdate} hasPendingUpdate={hasPendingUpdate}
startUpdate={startUpdate}
// See the comment above about `sharedGroupNames`. // See the comment above about `sharedGroupNames`.
sharedGroupNames={[]} sharedGroupNames={[]}
onEditProfile={() => { onEditProfile={() => {
toggleProfileEditor(); toggleProfileEditor();
setShowAvatarPopup(false); setShowAvatarPopup(false);
}} }}
onStartUpdate={() => {
startUpdate();
setShowAvatarPopup(false);
}}
onViewPreferences={() => { onViewPreferences={() => {
showSettings(); showSettings();
setShowAvatarPopup(false); setShowAvatarPopup(false);