diff --git a/core/chat/events.go b/core/chat/events.go index fa4d0b45c..892d26421 100644 --- a/core/chat/events.go +++ b/core/chat/events.go @@ -114,6 +114,10 @@ func (s *Server) userColorChanged(eventData chatClientEvent) { if err := user.ChangeUserColor(eventData.client.User.ID, receivedEvent.NewColor); err != nil { log.Errorln("error changing user display color", err) } + + // Resend client's user info with new color, otherwise the name change dialog would still show the old color + eventData.client.User.DisplayColor = receivedEvent.NewColor + eventData.client.sendConnectedClientInfo() } func (s *Server) userMessageSent(eventData chatClientEvent) { diff --git a/web/components/modals/NameChangeModal/NameChangeModal.tsx b/web/components/modals/NameChangeModal/NameChangeModal.tsx index dfb3cc12f..6571614aa 100644 --- a/web/components/modals/NameChangeModal/NameChangeModal.tsx +++ b/web/components/modals/NameChangeModal/NameChangeModal.tsx @@ -1,6 +1,6 @@ import React, { CSSProperties, FC, useState } from 'react'; import { useRecoilValue } from 'recoil'; -import { Input, Button, Select } from 'antd'; +import { Input, Button, Select, Form } from 'antd'; import { MessageType } from '../../../interfaces/socket-events'; import WebsocketService from '../../../services/websocket-service'; import { websocketServiceAtom, currentUserAtom } from '../../stores/ClientConfigStore'; @@ -32,7 +32,12 @@ export const NameChangeModal: FC = () => { const { displayName, displayColor } = currentUser; + const saveEnabled = () => + newName !== displayName && newName !== '' && websocketService?.isConnected(); + const handleNameChange = () => { + if (!saveEnabled()) return; + const nameChange = { type: MessageType.NAME_CHANGE, newName, @@ -40,8 +45,6 @@ export const NameChangeModal: FC = () => { websocketService.send(nameChange); }; - const saveEnabled = newName !== displayName && newName !== '' && websocketService?.isConnected(); - const handleColorChange = (color: string) => { const colorChange = { type: MessageType.COLOR_CHANGE, @@ -53,29 +56,32 @@ export const NameChangeModal: FC = () => { const maxColor = 8; // 0...n const colorOptions = [...Array(maxColor)].map((e, i) => i); + const saveButton = ( + + ); + return (
- Your chat display name is what people see when you send chat messages. Other information can - go here to mention auth, and stuff. - setNewName(e.target.value)} - placeholder="Your chat display name" - maxLength={30} - showCount - defaultValue={displayName} - /> - -
- Your Color + Your chat display name is what people see when you send chat messages. +
+ setNewName(e.target.value)} + placeholder="Your chat display name" + maxLength={30} + showCount + defaultValue={displayName} + /> + + -
+ + You can also authenticate an IndieAuth or Fediverse account via the "Authenticate" + menu.
); }; diff --git a/web/components/ui/Modal/Modal.tsx b/web/components/ui/Modal/Modal.tsx index 6a5d5e2b7..0aa4f5feb 100644 --- a/web/components/ui/Modal/Modal.tsx +++ b/web/components/ui/Modal/Modal.tsx @@ -58,7 +58,7 @@ export const Modal: FC = ({ afterClose={afterClose} bodyStyle={modalStyle} width={width} - zIndex={9999} + zIndex={999} footer={null} centered destroyOnClose diff --git a/web/styles/ant-overrides.scss b/web/styles/ant-overrides.scss index 5f024f14a..d2d792d88 100644 --- a/web/styles/ant-overrides.scss +++ b/web/styles/ant-overrides.scss @@ -130,7 +130,7 @@ DROPDOWN } .ant-input-affix-wrapper { - padding: 2px 5px; + padding: 4px 5px; background-color: var(--theme-color-components-form-field-background); }