@@ -48,21 +52,27 @@ const route = useRoute();
const showCreate = ref(false);
const rooms = ref([]);
const unreadCounts = ref>({});
+const isLoading = ref(true);
async function refreshRooms() {
- const fetchedRooms = await fetchRooms();
- rooms.value = fetchedRooms;
+ isLoading.value = true;
- fetchedRooms.forEach(room => {
- console.log(`Unread count for room ${room.name}: ${room.unread_count}`);
+ try {
+ const fetchedRooms = await fetchRooms();
+ rooms.value = fetchedRooms;
- // If the room isn't the currently active one, store the count
- if (room.unread_count && route.params.uuid !== room.uuid) {
- unreadCounts.value[room.uuid] = room.unread_count;
- } else {
- unreadCounts.value[room.uuid] = 0;
- }
- });
+ fetchedRooms.forEach(room => {
+ if (room.unread_count && route.params.uuid !== room.uuid) {
+ unreadCounts.value[room.uuid] = room.unread_count;
+ } else {
+ unreadCounts.value[room.uuid] = 0;
+ }
+ });
+ } catch (error) {
+ console.error("Failed to refresh rooms", error);
+ } finally {
+ isLoading.value = false;
+ }
}
const incrementUnread = (roomUuid: string) => {
@@ -72,7 +82,7 @@ const incrementUnread = (roomUuid: string) => {
unreadCounts.value[roomUuid] = current + 1;
};
-defineExpose({ incrementUnread });
+defineExpose({ incrementUnread, refreshRooms });
watch(
() => route.params.uuid,
@@ -85,7 +95,6 @@ watch(
);
onMounted(async () => {
- // rooms.value = await fetchRooms();
await refreshRooms()
});
@@ -111,6 +120,7 @@ onMounted(async () => {
left: 50%;
transform: translate(-50%, -50%);
margin: 0;
+ width: 100%;
}
.wait-msg {
@@ -162,7 +172,6 @@ onMounted(async () => {
}
.rooms-header h2 {
- /* font-size: 1rem; */
margin: 0;
margin-left: 45px;
}
@@ -189,7 +198,6 @@ onMounted(async () => {
}
.room-item.active {
- /* border: 1px solid var(--border); */
background: var(--panel-accent);
color: var(--accent);
}
diff --git a/src/locales/en.ftl b/src/locales/en.ftl
index 54494b6..3a62b8d 100644
--- a/src/locales/en.ftl
+++ b/src/locales/en.ftl
@@ -25,6 +25,7 @@ auth-error-email-invalid = Please enter a valid email address
## Chat page
chat-no-room = Select a room to start talking
+chat-no-messages = No messages yet. Say hi!
chat-input-placeholder = type a message
chat-invite-title = Invite People
chat-invite-receiver = Receiver username
@@ -32,8 +33,16 @@ chat-invite-friend-too = Also send a friend request
chat-invite-send = Send
chat-invite-username-placeholder = username
chat-room-list-title = Rooms
+chat-room-list-empty = No rooms found
chat-room-list-connecting = Connecting...
chat-room-owner = by {$owner}
+chat-room-global = Global room
+chat-room-members = Members
+chat-room-actions-leave = Leave Room
+chat-room-actions-leave-confirm = Are you sure you want to leave this room?
+chat-room-actions-delete = Delete Room
+chat-room-actions-delete-confirm = Are you sure you want to delete this room? This cannot be undone.
+chat-room-actions-ownership = Transfer Ownership
chat-create-title = Create room
chat-create-name = Room name
chat-create-name-placeholder = room name
@@ -95,6 +104,9 @@ warning-wrongversion-dismiss = I know what I'm doing
## Shared
shared-cancel = Cancel
+shared-close = Close
shared-error = An error occurred
shared-save = Save
shared-updating = Updating
+shared-delete = Delete
+shared-leave = Leave
diff --git a/src/locales/fr.ftl b/src/locales/fr.ftl
index 99f1890..3f4a204 100644
--- a/src/locales/fr.ftl
+++ b/src/locales/fr.ftl
@@ -25,8 +25,10 @@ auth-error-email-invalid = Veuillez entrer une adresse email valide
## Chat page
chat-no-room = Sélectionnez un salon pour commencer à discuter
+chat-no-messages = Pas encore de messages. Dites bonjour !
chat-input-placeholder = tapez un message
chat-invite-title = Inviter des gens
+chat-room-list-empty = Aucun salon trouvé
chat-invite-receiver = Nom du destinataire
chat-invite-friend-too = Envoyer aussi une demande d'ami
chat-invite-send = Envoyer
@@ -34,6 +36,13 @@ chat-invite-username-placeholder = nom d'utilisateur
chat-room-list-title = Salons
chat-room-list-connecting = Connexion...
chat-room-owner = par {$owner}
+chat-room-global = Salon global
+chat-room-members = Membres
+chat-room-actions-leave = Quitter le Salon
+chat-room-actions-leave-confirm = Voulez-vous vraiment quitter ce salon?
+chat-room-actions-delete = Supprimer le Salon
+chat-room-actions-delete-confirm = Voulez-vous vraiment supprimer ce salon? C'est irréversible.
+chat-room-actions-ownership = Transférer la Propriété
chat-create-title = Créer un salon
chat-create-name = Nom du salon
chat-create-name-placeholder = nom du salon
@@ -93,6 +102,9 @@ warning-wrongversion-dismiss = Je sais ce que je fais
## Shared
shared-cancel = Annuler
+shared-close = Fermer
shared-error = Une erreur est survenue
shared-save = Enregistrer
shared-updating = Mise à jour...
+shared-delete = Supprimer
+shared-leave = Quitter
diff --git a/src/main.ts b/src/main.ts
index 2c2bd77..1d2a342 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -28,9 +28,9 @@ async function init() {
init()
-// export const API = 'http://127.0.0.1:8080'
-export const API = 'http://192.168.1.183:8080'
+export const API = 'http://127.0.0.1:8080'
+// export const API = 'http://192.168.1.183:8080'
// export const API = 'https://alatreon.org/frangipane'
-// export const API_WS = 'ws://127.0.0.1:8080/ws'
-export const API_WS = 'ws://192.168.1.183:8080/ws'
+export const API_WS = 'ws://127.0.0.1:8080/ws'
+// export const API_WS = 'ws://192.168.1.183:8080/ws'
// export const API_WS = 'wss://alatreon.org/frangipane/ws'
diff --git a/src/pages/ChatPage.vue b/src/pages/ChatPage.vue
index 9d73e19..df1ac65 100644
--- a/src/pages/ChatPage.vue
+++ b/src/pages/ChatPage.vue
@@ -13,27 +13,39 @@
-
+