setting default subject update string

This commit is contained in:
Roland Osborne 2022-08-20 23:15:43 -07:00
parent 2db3178510
commit 4b0ec4239e
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@ export function EditSubject({ state, actions }) {
return ( return (
<EditSubjectWrapper> <EditSubjectWrapper>
<Input placeholder="Subject (optional)" spellCheck="false" autocapitalize="word" <Input placeholder="Subject (optional)" spellCheck="false" autocapitalize="word"
defaultValue={state.subject} onChange={(e) => actions.setSubjectUpdate(e.target.value)} /> value={state.subjectUpdate} onChange={(e) => actions.setSubjectUpdate(e.target.value)} />
</EditSubjectWrapper> </EditSubjectWrapper>
); );
} }

View File

@ -28,7 +28,7 @@ export function useDetails(cardId, channelId) {
} }
useEffect(() => { useEffect(() => {
let img, subject, host, started, contacts let img, subject, subjectUpdate, host, started, contacts
let chan; let chan;
if (cardId) { if (cardId) {
const cardChan = card.state.cards.get(cardId); const cardChan = card.state.cards.get(cardId);
@ -56,6 +56,7 @@ export function useDetails(cardId, channelId) {
const parsed = JSON.parse(chan.data.channelDetail.data); const parsed = JSON.parse(chan.data.channelDetail.data);
if (parsed.subject) { if (parsed.subject) {
subject = parsed.subject; subject = parsed.subject;
subjectUpdate = subject;
} }
const date = new Date(chan.data.channelDetail.created * 1000); const date = new Date(chan.data.channelDetail.created * 1000);
const now = new Date(); const now = new Date();
@ -88,7 +89,7 @@ export function useDetails(cardId, channelId) {
} }
}); });
updateState({ img, subject, host, started, contacts, members, unknown }); updateState({ img, subject, host, started, contacts, members, unknown, subjectUpdate });
}, [cardId, channelId, card, channel]); }, [cardId, channelId, card, channel]);
const actions = { const actions = {