Skip to content

Commit 1b435e3

Browse files
authored
feat: better reply sep (#368)
1 parent 0627bd8 commit 1b435e3

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

packages/frontend-main/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<meta property="twitter:title" content="dither.chat - The public protocol for thought" />
1818
<meta property="twitter:description" content="Dither is a public messaging protocol that anyone can build on. All data is public and immutable on the AtomOne blockchain." />
1919
<meta property="twitter:image" content="/meta.png" />
20+
<script defer src="https://cloud.umami.is/script.js" data-website-id="59dbe1e2-7888-41d0-845c-d9d17a14956a"></script>
2021
</head>
2122
<body>
2223
<div id="app"></div>

packages/frontend-main/src/localization/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export const messages = {
4444
unfollow: 'Unfollow',
4545
newPost: 'New post',
4646
reply: 'Reply',
47+
closeReply: 'Close Reply',
48+
createReply: 'Create Reply',
4749
mintscan: 'See on Mintscan',
4850
pingpub: 'See on Ping.pub',
4951
showImage: 'Show image',

packages/frontend-main/src/views/PostView.vue

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const repliesQuery = useReplies({ hash });
4343
const POST_HASH_LEN = 64;
4444
const MAX_CHARS = 512 - ('dither.Reply("", "")'.length + POST_HASH_LEN);
4545
const reply = ref('');
46+
const showReply = ref(false);
4647
const isBalanceInputValid = ref(false);
4748
const inputPhotonModel = ref(Decimal.fromAtomics('1', fractionalDigits).toFloatApproximation());
4849
const configStore = useConfigStore();
@@ -100,30 +101,37 @@ async function handleReply() {
100101

101102
<!-- Transaction Form -->
102103
<div v-if="wallet.loggedIn.value" class="flex flex-col gap-4 mt-4">
103-
<div v-if="isDefaultAmountInvalid" class="flex flex-col items-right gap-4">
104-
<span class="text-sm whitespace-pre-line">{{ $t('components.PostView.invalidDefaultAmount') }}</span>
105-
<Button size="sm" @click="router.push({ name: routesNames.settingsDefaultAmount });" class="ml-auto">
106-
{{ $t('components.Button.adjustDefaultAmount') }}
107-
</Button>
108-
</div>
109-
110-
<template v-else>
111-
<div class="flex flex-row item-center">
112-
<UserAvatar :userAddress="wallet.address.value" disabled/>
113-
<Textarea :placeholder="$t('placeholders.reply')" v-model="reply" :maxlength="MAX_CHARS" class="ml-1 mt-1" />
114-
</div>
115-
116-
<div class="flex flex-row gap-4">
117-
<InputPhoton v-if="!configStore.config.defaultAmountEnabled" v-model="inputPhotonModel" @on-validity-change="handleInputValidity" />
118-
<Button size="sm" :disabled="!canReply" @click="handleReply" class="ml-auto">
119-
{{ $t('components.Button.reply') }}
104+
<template v-if="showReply">
105+
<div v-if="isDefaultAmountInvalid" class="flex flex-col items-right gap-4">
106+
<span class="text-sm whitespace-pre-line">{{ $t('components.PostView.invalidDefaultAmount') }}</span>
107+
<Button size="sm" @click="router.push({ name: routesNames.settingsDefaultAmount });" class="ml-auto">
108+
{{ $t('components.Button.adjustDefaultAmount') }}
120109
</Button>
121110
</div>
111+
112+
<template v-else>
113+
<div class="flex flex-row item-center">
114+
<UserAvatar :userAddress="wallet.address.value" disabled/>
115+
<Textarea :placeholder="$t('placeholders.reply')" v-model="reply" :maxlength="MAX_CHARS" class="ml-1 mt-1" />
116+
</div>
117+
118+
<div class="flex flex-row gap-4">
119+
<InputPhoton v-if="!configStore.config.defaultAmountEnabled" v-model="inputPhotonModel" @on-validity-change="handleInputValidity" />
120+
<Button size="sm" :disabled="!canReply" @click="handleReply" class="ml-auto">
121+
{{ $t('components.Button.reply') }}
122+
</Button>
123+
</div>
124+
</template>
122125
</template>
123126
</div>
124127
</div>
125128
</div>
126-
129+
<div class="flex flex-row p-3 border-t border-gray-200 items-center justify-between">
130+
<div class="text-lg font-semibold">Replies</div>
131+
<Button size="sm" @click="showReply = !showReply" v-if="wallet.loggedIn.value" class="ml-auto">
132+
{{ showReply ? $t('components.Button.closeReply') : $t('components.Button.createReply') }}
133+
</Button>
134+
</div>
127135
<!-- Replies posts list -->
128136
<PostsList :query="repliesQuery" hideEmptyText/>
129137
</MainLayout>

0 commit comments

Comments
 (0)