v0.6.7 updated message display name handling
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jama-frontend",
|
||||
"version": "0.6.6",
|
||||
"version": "0.6.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -13,6 +13,7 @@ export default function GroupInfoModal({ group, onClose, onUpdated, onBack }) {
|
||||
const [addSearch, setAddSearch] = useState('');
|
||||
const [addResults, setAddResults] = useState([]);
|
||||
const [customName, setCustomName] = useState(group.owner_name_original ? group.name : '');
|
||||
const [savedCustomName, setSavedCustomName] = useState(group.owner_name_original ? group.name : '');
|
||||
const [savingCustom, setSavingCustom] = useState(false);
|
||||
|
||||
const isDirect = !!group.is_direct;
|
||||
@@ -30,8 +31,10 @@ export default function GroupInfoModal({ group, onClose, onUpdated, onBack }) {
|
||||
const handleCustomName = async () => {
|
||||
setSavingCustom(true);
|
||||
try {
|
||||
await api.setCustomGroupName(group.id, customName.trim());
|
||||
toast(customName.trim() ? 'Custom name saved' : 'Custom name removed', 'success');
|
||||
const saved = customName.trim();
|
||||
await api.setCustomGroupName(group.id, saved);
|
||||
setSavedCustomName(saved);
|
||||
toast(saved ? 'Custom name saved' : 'Custom name removed', 'success');
|
||||
onUpdated();
|
||||
} catch (e) {
|
||||
toast(e.message, 'error');
|
||||
@@ -165,9 +168,17 @@ export default function GroupInfoModal({ group, onClose, onUpdated, onBack }) {
|
||||
placeholder={group.owner_name_original || group.name}
|
||||
onKeyDown={e => e.key === 'Enter' && handleCustomName()}
|
||||
/>
|
||||
<button className="btn btn-primary btn-sm" onClick={handleCustomName} disabled={savingCustom}>
|
||||
{customName.trim() ? 'Save' : 'Remove'}
|
||||
</button>
|
||||
{customName.trim() !== savedCustomName ? (
|
||||
<button className="btn btn-primary btn-sm" onClick={handleCustomName} disabled={savingCustom}>
|
||||
Save
|
||||
</button>
|
||||
) : savedCustomName ? (
|
||||
<button className="btn btn-sm" style={{ background: 'var(--surface-variant)', color: 'var(--text-secondary)' }}
|
||||
onClick={() => { setCustomName(''); }}
|
||||
disabled={savingCustom}>
|
||||
Remove
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
{group.owner_name_original && (
|
||||
<p className="text-xs" style={{ color: 'var(--text-tertiary)', marginTop: 4 }}>
|
||||
|
||||
Reference in New Issue
Block a user