Adjust some layout stuff in composer

This commit is contained in:
Lim Chee Aun 2023-03-23 16:13:22 +08:00
parent 0f1b08b3ea
commit 9071439c12
2 changed files with 527 additions and 510 deletions

View file

@ -1,14 +1,18 @@
#compose-container-outer {
width: 100%;
height: 100vh;
height: 100dvh;
overflow: auto;
align-self: flex-start;
padding: env(safe-area-inset-top) env(safe-area-inset-right)
env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#compose-container { #compose-container {
margin: auto;
width: var(--main-width); width: var(--main-width);
max-width: 100vw; max-width: 100vw;
align-self: stretch; align-self: stretch;
animation: fade-in 0.2s ease-out; animation: fade-in 0.2s ease-out;
max-height: 100vh;
overflow: auto;
}
#compose-container.standalone {
max-height: none;
margin: auto;
} }
#compose-container .compose-top { #compose-container .compose-top {
@ -41,6 +45,7 @@
#compose-container textarea { #compose-container textarea {
font-size: 150%; font-size: 150%;
font-size: calc(100% + 50% / var(--text-weight)); font-size: calc(100% + 50% / var(--text-weight));
max-height: 65vh;
} }
} }

View file

@ -498,6 +498,7 @@ function Compose({
}, [mediaAttachments]); }, [mediaAttachments]);
return ( return (
<div id="compose-container-outer">
<div id="compose-container" class={standalone ? 'standalone' : ''}> <div id="compose-container" class={standalone ? 'standalone' : ''}>
<div class="compose-top"> <div class="compose-top">
{currentAccountInfo?.avatarStatic && ( {currentAccountInfo?.avatarStatic && (
@ -706,7 +707,9 @@ function Compose({
(media) => !media.description?.trim?.(), (media) => !media.description?.trim?.(),
); );
if (hasNoDescriptions) { if (hasNoDescriptions) {
const yes = confirm('Some media have no descriptions. Continue?'); const yes = confirm(
'Some media have no descriptions. Continue?',
);
if (!yes) return; if (!yes) return;
} }
} }
@ -776,17 +779,21 @@ function Compose({
sensitive, sensitive,
poll, poll,
// mediaIds: mediaAttachments.map((attachment) => attachment.id), // mediaIds: mediaAttachments.map((attachment) => attachment.id),
media_ids: mediaAttachments.map((attachment) => attachment.id), media_ids: mediaAttachments.map(
(attachment) => attachment.id,
),
}; };
if (editStatus && supports('@mastodon/edit-media-attributes')) { if (editStatus && supports('@mastodon/edit-media-attributes')) {
params.media_attributes = mediaAttachments.map((attachment) => { params.media_attributes = mediaAttachments.map(
(attachment) => {
return { return {
id: attachment.id, id: attachment.id,
description: attachment.description, description: attachment.description,
// focus // focus
// thumbnail // thumbnail
}; };
}); },
);
} else if (!editStatus) { } else if (!editStatus) {
params.visibility = visibility; params.visibility = visibility;
// params.inReplyToId = replyToStatus?.id || undefined; // params.inReplyToId = replyToStatus?.id || undefined;
@ -1062,12 +1069,17 @@ function Compose({
))} ))}
</select> </select>
</label>{' '} </label>{' '}
<button type="submit" class="large" disabled={uiState === 'loading'}> <button
type="submit"
class="large"
disabled={uiState === 'loading'}
>
{replyToStatus ? 'Reply' : editStatus ? 'Update' : 'Post'} {replyToStatus ? 'Reply' : editStatus ? 'Update' : 'Post'}
</button> </button>
</div> </div>
</form> </form>
</div> </div>
</div>
); );
} }