Add chat renaming support, fix #8
This commit is contained in:
parent
634550ea3d
commit
507a35853c
|
@ -22,11 +22,17 @@ a.is-disabled {
|
|||
}
|
||||
|
||||
/* Show the edit button on hover of the user message */
|
||||
.usermessage:hover > .message-body > .editbutton {
|
||||
.usermessage:hover .editbutton {
|
||||
/* TODO: add when ready: display: block !important; */
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
/* Show the edit button on hover of the chat name */
|
||||
.chatname:hover .editbutton {
|
||||
display: inline !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
$footer-padding: 3rem 1.5rem;
|
||||
|
||||
@import "/node_modules/bulma/bulma.sass";
|
|
@ -106,9 +106,21 @@
|
|||
</script>
|
||||
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<div class="level-left chatname">
|
||||
<div class="level-item">
|
||||
<p class="subtitle is-5">Chat {chatId}</p>
|
||||
<p class="subtitle is-5">
|
||||
{chat.name}
|
||||
<a
|
||||
href={"#"}
|
||||
class="greyscale ml-2 is-hidden editbutton"
|
||||
on:click|preventDefault={() => {
|
||||
chat.name = prompt("Enter a new name for this chat", chat.name);
|
||||
chatsStorage.set($chatsStorage);
|
||||
}}
|
||||
>
|
||||
✏️
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
class="panel-block {!apiKey ? 'is-disabled' : ''} {activeChatId === chat.id
|
||||
? 'has-background-light'
|
||||
: ''}"
|
||||
on:click|preventDefault={() => (activeChatId = chat.id)}>Chat {chat.id}</a
|
||||
on:click|preventDefault={() => (activeChatId = chat.id)}>{chat.name}</a
|
||||
>
|
||||
</li>
|
||||
{/each}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
// Add a new chat
|
||||
chats.push({
|
||||
id: chatId,
|
||||
name: `Chat ${chatId}`,
|
||||
messages: [],
|
||||
});
|
||||
chatsStorage.set(chats);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script context="module" lang="ts">
|
||||
export type Chat = {
|
||||
id: number;
|
||||
name: string;
|
||||
messages: Message[];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue