fix bio editor and clear account settings when fields are updated
This commit is contained in:
1 parent
0bdd0c8cd4
commit
48fb8686cd
3 files changed
+26
-11
No files matched your search
@@ -11,6 +11,8 @@ _skipped a number since lots of updates :3_
|
||||
- Pinned messages actually jump to the damn pins instead of somewhere vaguely nearby half the time.
|
||||
- that is... if they've been seen before. otherwise it just gives up sadly.
|
||||
- Mobile context menu is opened by double tapping on a message instead of holding.
|
||||
- Fixed bio editor formatting.
|
||||
- Properly clear user data when account settings are updated.
|
||||
|
||||
## Version 1.1.1
|
||||
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
import { style, globalStyle } from '@vanilla-extract/css';
|
||||
import { config } from 'folds';
|
||||
|
||||
export const BioEditorContainer = style({
|
||||
backgroundColor: 'var(--sable-bg-container)',
|
||||
borderRadius: 'var(--radii-300)',
|
||||
borderRadius: config.radii.R400,
|
||||
overflow: 'hidden',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="EditorTextarea"]`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="EditorTextareaScroll"]`, {
|
||||
globalStyle(`${BioEditorContainer} div[class*="EditorTextarea"]`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
border: 'none !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="Toolbar"]`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
padding: 'var(--space-S100) !important',
|
||||
borderTop: '1px solid var(--sable-outline-variant) !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="Toolbar"] button`, {
|
||||
backgroundColor: 'var(--sable-bg-container) !important',
|
||||
backgroundColor: 'transparent !important',
|
||||
boxShadow: 'none !important',
|
||||
});
|
||||
|
||||
globalStyle(`${BioEditorContainer} [class*="Toolbar"] button:hover`, {
|
||||
backgroundColor: 'var(--sable-surface-variant) !important',
|
||||
});
|
||||
@@ -48,6 +48,8 @@ import { TimezoneEditor } from './TimezoneEditor';
|
||||
import { PronounEditor } from './PronounEditor';
|
||||
import { BioEditor } from './BioEditor';
|
||||
import { NameColorEditor } from './NameColorEditor';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { profilesCacheAtom } from '../../../state/userRoomProfile';
|
||||
|
||||
type PronounSet = {
|
||||
summary: string;
|
||||
@@ -488,6 +490,7 @@ function ProfileDisplayName({ profile, userId }: ProfileProps) {
|
||||
|
||||
function ProfileExtended({ profile, userId }: ProfileProps) {
|
||||
const mx = useMatrixClient();
|
||||
const setGlobalProfiles = useSetAtom(profilesCacheAtom);
|
||||
|
||||
const pronouns = (profile.pronouns as PronounSet[]) || [];
|
||||
|
||||
@@ -495,16 +498,21 @@ function ProfileExtended({ profile, userId }: ProfileProps) {
|
||||
// Only renders them, can't edit or set
|
||||
const extendedFields = Object.entries(profile.extended || {});
|
||||
|
||||
const handleSaveField = useCallback((key: string, value: any) => {
|
||||
(mx as MatrixClient).setExtendedProfileProperty?.(key, value);
|
||||
}, [mx]);
|
||||
const handleSaveField = useCallback(async (key: string, value: any) => {
|
||||
await (mx).setExtendedProfileProperty?.(key, value);
|
||||
setGlobalProfiles((prev) => {
|
||||
const newCache = { ...prev };
|
||||
delete newCache[userId];
|
||||
return newCache;
|
||||
});
|
||||
}, [mx, userId, setGlobalProfiles]);
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Extended Profile</Text>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column" gap="400">
|
||||
<NameColorEditor
|
||||
current={profile.extended?.["moe.sable.app.name_color"]}
|
||||
current={profile.nameColor || profile.extended?.["moe.sable.app.name_color"]}
|
||||
onSave={(color) => handleSaveField("moe.sable.app.name_color", color)}
|
||||
/>
|
||||
</SequenceCard>
|
||||
|
||||
Reference in new issue
Block a user