Display information about replied-to/edited status

This commit is contained in:
tusooa 2023-03-10 13:22:44 -05:00
parent f13444a3c8
commit a9f374b18f
No known key found for this signature in database
GPG Key ID: 42AEC43D48433C51
3 changed files with 48 additions and 9 deletions

View File

@ -1,10 +1,12 @@
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue' import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
import StatusContent from 'src/components/status_content/status_content.vue'
const Draft = { const Draft = {
components: { components: {
PostStatusForm, PostStatusForm,
ConfirmModal ConfirmModal,
StatusContent
}, },
props: { props: {
draft: { draft: {
@ -33,6 +35,9 @@ const Draft = {
draftId: this.draft.id, draftId: this.draft.id,
...this.relAttrs ...this.relAttrs
} }
},
refStatus () {
return this.draft.refId ? this.$store.state.statuses.allStatusesObject[this.draft.refId] : undefined
} }
}, },
methods: { methods: {

View File

@ -1,8 +1,5 @@
<template> <template>
<article class="Draft"> <article class="Draft">
<div v-if="draft.inReplyToStatusId">
{{ draft.inReplyToStatusId }}
</div>
<div class="actions"> <div class="actions">
<button <button
class="btn button-default" class="btn button-default"
@ -19,12 +16,34 @@
{{ $t('drafts.abandon') }} {{ $t('drafts.abandon') }}
</button> </button>
</div> </div>
<p <div
v-if="!editing" v-if="!editing"
class="draft-content" class="status-content"
> >
{{ draft.status }} <div>
</p> <i18n-t
v-if="draft.type === 'reply' || draft.type === 'edit'"
tag="span"
:keypath="draft.type === 'reply' ? 'drafts.replying' : 'drafts.editing'"
>
<template #statusLink>
<router-link
class="faint-link"
:to="{ name: 'conversation', params: { id: draft.refId } }"
>
{{ refStatus.external_url }}
</router-link>
</template>
</i18n-t>
<StatusContent
v-if="draft.refId"
class="status-content"
:status="refStatus"
:compact="true"
/>
</div>
<p>{{ draft.status }}</p>
</div>
<div v-if="editing"> <div v-if="editing">
<PostStatusForm <PostStatusForm
v-bind="postStatusFormProps" v-bind="postStatusFormProps"
@ -49,9 +68,22 @@
<script src="./draft.js"></script> <script src="./draft.js"></script>
<style lang="scss"> <style lang="scss">
@import "src/variables";
.Draft { .Draft {
margin: 1em; margin: 1em;
.status-content {
border: 1px solid $fallback--faint;
border-color: var(--faint, $fallback--faint);
border-radius: $fallback--inputRadius;
border-radius: var(--inputRadius, $fallback--inputRadius);
color: $fallback--text;
color: var(--text, $fallback--text);
padding: 0.5em;
margin: 0.5em 0;
}
.actions { .actions {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -1163,6 +1163,8 @@
"abandon_confirm_title": "Abandon confirmation", "abandon_confirm_title": "Abandon confirmation",
"abandon_confirm": "Do you really want to abandon this draft?", "abandon_confirm": "Do you really want to abandon this draft?",
"abandon_confirm_accept_button": "Abandon", "abandon_confirm_accept_button": "Abandon",
"abandon_confirm_cancel_button": "Keep" "abandon_confirm_cancel_button": "Keep",
"replying": "Replying to {statusLink}",
"editing": "Editing {statusLink}"
} }
} }