Skip to content

Commit

Permalink
changed api route
Browse files Browse the repository at this point in the history
  • Loading branch information
amaan-mohib committed Mar 2, 2024
1 parent 6f652d0 commit 3b34574
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
6 changes: 2 additions & 4 deletions client/src/Views/Invite.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { db } from "../utils/firebase";
import socket from "../utils/socket";
import { app, user } from "../utils/store";
import { AVATAR_ENDPOINT } from "../utils/avatar";
const params = useParams();
let error = "";
Expand Down Expand Up @@ -100,10 +101,7 @@
<Loader />
{:else if room}
<img
src={room.img ||
`https://avatars.dicebear.com/api/jdenticon/${room.name
.split(" ")[0]
.toLowerCase()}.svg`}
src={room.img || AVATAR_ENDPOINT(room.name)}
alt="Room Icon"
class="pfp"
/>
Expand Down
2 changes: 1 addition & 1 deletion client/src/Views/Navbar/RoomsBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
{#if !isNext}
<h2>Create a Room</h2>
<p class="size14 grey-text" style="margin-bottom: 20px;">
Or a join a Room, if you have the ID already
Or join a Room, if you have the ID already
</p>
<button
on:click={() => {
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/EditRoom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import clickOutside from "../utils/clickOutside";
import finalCompressedBlob from "../utils/compressImage";
import { db, storageRef } from "../utils/firebase";
import { AVATAR_ENDPOINT } from "../utils/avatar";
import { appName, menu, selectedRoom } from "../utils/store";
let name = $selectedRoom.name;
Expand Down Expand Up @@ -178,9 +179,7 @@
pfpTemp = null;
if (!remove) {
remove = true;
pfp = `https://avatars.dicebear.com/api/jdenticon/${name
.split(" ")
.join("")}.svg`;
pfp = AVATAR_ENDPOINT(name);
preview.src = pfp;
} else {
remove = false;
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/Profile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import finalCompressedBlob from "../utils/compressImage";
import { db, storageRef } from "../utils/firebase";
import { user } from "../utils/store";
import { AVATAR_ENDPOINT } from "../utils/avatar";
let name = $user.displayName;
let pfp = $user.photoURL;
Expand Down Expand Up @@ -123,9 +124,7 @@
pfpTemp = null;
if (!remove) {
remove = true;
pfp = `https://avatars.dicebear.com/api/identicon/${name
.split(" ")
.join("")}.svg`;
pfp = AVATAR_ENDPOINT(name);
preview.src = pfp;
} else {
remove = false;
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/Room.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import { selectedRoom } from "../utils/store";
import { AVATAR_ENDPOINT } from "../utils/avatar";
export let img = "";
export let name = "";
Expand All @@ -19,9 +20,7 @@
class="room-icon"
src={img
? img
: `https://avatars.dicebear.com/api/jdenticon/${name
.split(" ")[0]
.toLowerCase()}.svg`}
: AVATAR_ENDPOINT(name)}
alt={name}
/>
{/if}
Expand Down
2 changes: 2 additions & 0 deletions client/src/utils/avatar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const AVATAR_ENDPOINT = (name) =>
`https://api.dicebear.com/7.x/identicon/svg?seed=${name.split(" ").join("")}`;

0 comments on commit 3b34574

Please sign in to comment.