This commit is contained in:
Adrien Bouvais 2024-06-01 15:29:19 +02:00
parent fceaaef732
commit 3a98202a1c
2 changed files with 4 additions and 11 deletions

View File

@ -15,13 +15,7 @@ import (
) )
func ChatPageHandler(c *fiber.Ctx) error { func ChatPageHandler(c *fiber.Ctx) error {
fmt.Println("Cookies: ", c.Cookies("jade-edgedb-auth-token")) return c.Render("chat", fiber.Map{}, "layouts/main")
if c.Cookies("jade-edgedb-auth-token") == "" {
return c.Render("chat", fiber.Map{"IsLogin": false, "HaveKey": false, "IsSubscribed": false, "IsLimiteReached": false}, "layouts/main")
} else {
fmt.Println("Here")
return c.Render("chat", fiber.Map{"IsLogin": checkIfLogin(c), "HaveKey": checkIfHaveKey(c), "IsSubscribed": IsCurrentUserSubscribed(c), "IsLimiteReached": IsCurrentUserLimiteReached(c)}, "layouts/main")
}
} }
func DeleteMessageHandler(c *fiber.Ctx) error { func DeleteMessageHandler(c *fiber.Ctx) error {
@ -100,7 +94,6 @@ func generateChatHTML(c *fiber.Ctx) string {
fmt.Println("Error getting current conversation") fmt.Println("Error getting current conversation")
panic(err) panic(err)
} }
fmt.Println("Current conversation: ", currentConv.Name)
// Maybe redo that to be area by area because look like shit rn. It come from early stage of dev. It work tho soooo... // Maybe redo that to be area by area because look like shit rn. It come from early stage of dev. It work tho soooo...
var Messages []Message var Messages []Message

View File

@ -16,7 +16,7 @@
data-id="{{ Conversation.ID.String() }}" style="cursor: pointer;" data-id="{{ Conversation.ID.String() }}" style="cursor: pointer;"
onclick="toggleConversationSelection(this, '{{ Conversation.Name }}')" onclick="toggleConversationSelection(this, '{{ Conversation.Name }}')"
hx-get="/selectConversation?conversation-id={{ Conversation.ID.String() }}" hx-swap="outerHTML" hx-get="/selectConversation?conversation-id={{ Conversation.ID.String() }}" hx-swap="outerHTML"
hx-target="#chat-container"> hx-target="#chat-container" name="{{ Conversation.Name }}">
<span>{{ Conversation.Name }}</span> <span>{{ Conversation.Name }}</span>
</div> </div>
{% endfor %} {% endfor %}
@ -159,10 +159,10 @@
document.getElementById('conversation-list').classList.remove('is-hidden'); document.getElementById('conversation-list').classList.remove('is-hidden');
// If the selected is the default conversation // If the selected is the default conversation
if (document.getElementsByClassName('selected icon-conv')[0].getAttribute('data-id') === 'default') { if (document.getElementsByClassName('selected icon-conv')[0].getAttribute('name') === 'Default') {
document.getElementById('delete-conversation-button').classList.add('is-hidden'); document.getElementById('delete-conversation-button').classList.add('is-hidden');
document.getElementById('archive-default-conversation-button').classList.remove('is-hidden'); document.getElementById('archive-default-conversation-button').classList.remove('is-hidden');
document.getElementById('confirm-archive-default-conversation-button').classList.remove('is-hidden'); document.getElementById('confirm-archive-default-conversation-button').classList.add('is-hidden');
} else { } else {
document.getElementById('delete-conversation-button').classList.remove('is-hidden'); document.getElementById('delete-conversation-button').classList.remove('is-hidden');
document.getElementById('archive-default-conversation-button').classList.add('is-hidden'); document.getElementById('archive-default-conversation-button').classList.add('is-hidden');