nsarrazin HF staff commited on
Commit
a4e40b1
1 Parent(s): 6b19d45

Allow retry on shared conversations (#839)

Browse files
src/lib/components/chat/ChatMessage.svelte CHANGED
@@ -240,36 +240,39 @@
240
  </div>
241
  {/if}
242
  </div>
243
- {#if isAuthor && !loading && message.content}
244
  <div
245
  class="absolute bottom-1 right-0 -mb-4 flex max-md:transition-all md:bottom-0 md:group-hover:visible md:group-hover:opacity-100
246
- {message.score ? 'visible opacity-100' : 'invisible max-md:-translate-y-4 max-md:opacity-0'}
247
- {isTapped || isCopied ? 'max-md:visible max-md:translate-y-0 max-md:opacity-100' : ''}
248
- "
249
  >
250
- <button
251
- class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300
 
252
  {message.score && message.score > 0
253
- ? 'text-green-500 hover:text-green-500 dark:text-green-400 hover:dark:text-green-400'
254
- : ''}"
255
- title={message.score === 1 ? "Remove +1" : "+1"}
256
- type="button"
257
- on:click={() => dispatch("vote", { score: message.score === 1 ? 0 : 1, id: message.id })}
258
- >
259
- <CarbonThumbsUp class="h-[1.14em] w-[1.14em]" />
260
- </button>
261
- <button
262
- class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300
 
263
  {message.score && message.score < 0
264
- ? 'text-red-500 hover:text-red-500 dark:text-red-400 hover:dark:text-red-400'
265
- : ''}"
266
- title={message.score === -1 ? "Remove -1" : "-1"}
267
- type="button"
268
- on:click={() =>
269
- dispatch("vote", { score: message.score === -1 ? 0 : -1, id: message.id })}
270
- >
271
- <CarbonThumbsDown class="h-[1.14em] w-[1.14em]" />
272
- </button>
 
273
  <button
274
  class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300"
275
  title="Retry"
 
240
  </div>
241
  {/if}
242
  </div>
243
+ {#if !loading && message.content}
244
  <div
245
  class="absolute bottom-1 right-0 -mb-4 flex max-md:transition-all md:bottom-0 md:group-hover:visible md:group-hover:opacity-100
246
+ {message.score ? 'visible opacity-100' : 'invisible max-md:-translate-y-4 max-md:opacity-0'}
247
+ {isTapped || isCopied ? 'max-md:visible max-md:translate-y-0 max-md:opacity-100' : ''}
248
+ "
249
  >
250
+ {#if isAuthor}
251
+ <button
252
+ class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300
253
  {message.score && message.score > 0
254
+ ? 'text-green-500 hover:text-green-500 dark:text-green-400 hover:dark:text-green-400'
255
+ : ''}"
256
+ title={message.score === 1 ? "Remove +1" : "+1"}
257
+ type="button"
258
+ on:click={() =>
259
+ dispatch("vote", { score: message.score === 1 ? 0 : 1, id: message.id })}
260
+ >
261
+ <CarbonThumbsUp class="h-[1.14em] w-[1.14em]" />
262
+ </button>
263
+ <button
264
+ class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300
265
  {message.score && message.score < 0
266
+ ? 'text-red-500 hover:text-red-500 dark:text-red-400 hover:dark:text-red-400'
267
+ : ''}"
268
+ title={message.score === -1 ? "Remove -1" : "-1"}
269
+ type="button"
270
+ on:click={() =>
271
+ dispatch("vote", { score: message.score === -1 ? 0 : -1, id: message.id })}
272
+ >
273
+ <CarbonThumbsDown class="h-[1.14em] w-[1.14em]" />
274
+ </button>
275
+ {/if}
276
  <button
277
  class="btn rounded-sm p-1 text-sm text-gray-400 focus:ring-0 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300"
278
  title="Retry"