Skip to content

Commit

Permalink
Update Sample to version 4.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul-cometchat committed Jun 17, 2024
1 parent 8bb9d89 commit 2073bef
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 32 deletions.
59 changes: 28 additions & 31 deletions src/Login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<script lang="ts">
/*es-lint disabled*/
import { defineComponent, inject, ref } from "vue";
import { defineComponent, inject, onBeforeMount, ref } from "vue";
import "@cometchat/uikit-elements";
import { fontHelper } from "@cometchat/uikit-resources";
import { CometChat } from "@cometchat/chat-sdk-javascript";
Expand All @@ -133,8 +133,15 @@ import {
} from "../assets";
import { CometChatUIKit } from "@cometchat/chat-uikit-vue";
import { metaInfo } from "../metaInfo";
import { users } from "../sampleApp/sampledata";
let buttonImage = "assets/button-opc.png";
type User = {
name: string;
uid: string;
avatar: string;
};
export default defineComponent({
name: "LoginComponent",
components: {},
Expand All @@ -148,6 +155,7 @@ export default defineComponent({
let enteredUid!: string;
let enteredName!: string;
let inProgress = ref(false);
const usersArray = ref<User[]>([]);
let avatarStyle: AvatarStyle = {
height: "32px",
Expand Down Expand Up @@ -236,36 +244,25 @@ export default defineComponent({
router.push({ path: "/signup" });
};
const usersArray = [
{
name: "Iron Man",
UID: "SUPERHERO1",
uid: "superhero1",
avatar:
"https://data-us.cometchat.io/assets/images/avatars/ironman.png",
},
{
name: "Captain America",
UID: "SUPERHERO2",
uid: "superhero2",
avatar:
"https://data-us.cometchat.io/assets/images/avatars/captainamerica.png",
},
{
name: "Spiderman",
UID: "SUPERHERO3",
uid: "superhero3",
avatar:
"https://data-us.cometchat.io/assets/images/avatars/spiderman.png",
},
{
name: "Wolvorine",
UID: "SUPERHERO4",
uid: "superhero4",
avatar:
"https://data-us.cometchat.io/assets/images/avatars/wolverine.png",
},
];
async function fetchDefaultUsers() {
try {
const response = await fetch(
"https://assets.cometchat.io/sampleapp/sampledata.json"
);
const data = await response.json();
usersArray.value = data.users;
} catch (error) {
console.log(
"fetching default users failed, using fallback data",
error
);
usersArray.value = users.users;
}
}
onBeforeMount(() => {
fetchDefaultUsers();
});
const styles: any = {
loginWrapperStyle: () => {
Expand Down
Binary file added src/assets/wolverine_avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/metaInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const metaInfo = {
name: "cometchat-chat-sample-app-vue",
version: "4.3.7",
version: "4.3.8",
type: "sample",
platform: "Vue",
};
35 changes: 35 additions & 0 deletions src/sampleApp/sampledata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import CaptainAmericaAvatar from "../assets/captainamerica_avatar.png";
import CyclopsAvatar from "../assets/cyclops_avatar.png";
import IronManAvatar from "../assets/ironman_avatar.png";
import SpidermanAvatar from "../assets/spiderman_avatar.png";
import WolverineAvatar from "../assets/wolverine_avatar.png";

export const users = {
users: [
{
uid: "superhero1",
name: "Iron Man",
avatar: IronManAvatar,
},
{
uid: "superhero2",
name: "Captain America",
avatar: CaptainAmericaAvatar,
},
{
uid: "superhero3",
name: "Spiderman",
avatar: SpidermanAvatar,
},
{
uid: "superhero4",
name: "Wolverine",
avatar: WolverineAvatar,
},
{
uid: "superhero5",
name: "Cyclops",
avatar: CyclopsAvatar,
},
],
};

0 comments on commit 2073bef

Please sign in to comment.