Skip to content

Instantly share code, notes, and snippets.

@swahaniroy
swahaniroy / style.js
Created August 5, 2021 11:39
Modify styles
"styles": [
"src/styles.css",
"node_modules/@ctrl/ngx-emoji-mart/picker.css",
"src/cometchat-pro-angular-ui-kit/CometChatWorkspace/projects/angular-chat-ui-kit/src/css/styles.scss"
]
@swahaniroy
swahaniroy / logincomponent.js
Created August 5, 2021 11:53
Login component
import { Component, OnInit } from "@angular/core";
import { NgForm } from "@angular/forms";
import { Router } from "@angular/router";
import { CometChat } from "@cometchat-pro/chat";
import { COMETCHAT_CONSTANTS } from "../../CONSTS";
import { User } from "./user";
import { ModalService } from "../_modal";
import { AuthService } from "./auth.service";
import { GetProductDetailService } from "../product/_api/get-product-detail.service";
@swahaniroy
swahaniroy / inboxcomponent.js
Created August 5, 2021 11:58
Inbox component
navigateToConversationListScreen() {
this.router.navigate(["/conversation"]);
}
@swahaniroy
swahaniroy / conversation.js
Created August 5, 2021 11:59
Conversation component
<div class="responsive">
<cometchat-conversation-list-with-messages></cometchat-conversation-list-with-messages>
</div>
@swahaniroy
swahaniroy / chatmodule.js
Created August 5, 2021 12:01
Chat module
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from "@angular/router";
import { InboxComponent } from './inbox.component';
import { CometChatConversationComponent } from './comet-chat-conversation.component';
import { CometChatConversationListWithMessages } from "@cometChatComponents/Chats/CometChat-conversation-list-with-messages/cometchat-conversation-list-with-messages.module";
import { CometChatMessages } from "@cometChatComponents/Messages/CometChat-messages/cometchat-messages.module";
import { AuthGuard } from "../account/auth.guard";
import { UserMessageComponent } from './user-message.component';
@swahaniroy
swahaniroy / facemask.js
Created August 5, 2021 12:53
Display facemask products
onViewFaceMask(): void {
this.router.navigate(["facemask"]);
}
@swahaniroy
swahaniroy / list.js
Created August 5, 2021 13:00
Facemask list
// ...
import { ProductModule } from "../product/product.module";
import { FaceMaskProductListComponent } from "../product/face-mask-product-list.component";
import { ProductDetailComponent } from "../product/product-detail.component";
const routes: Routes = [
{
path: "home",
component: ContentComponent,
@swahaniroy
swahaniroy / productdetail.js
Created August 5, 2021 13:10
Get product detail service
export class GetProductDetailService {
constructor() {
// ...
if (window.localStorage[PRODUCT_METADATA]) {
// always remove so that newly added product in facemasks.json will be added into the metadata
window.localStorage.removeItem(PRODUCT_METADATA);
}
this.initProductMetadataLocalStorage();
}
private initProductMetadataLocalStorage(): void {
@swahaniroy
swahaniroy / facemasklisting.js
Created August 5, 2021 13:13
Putting facemasks on sale to be listed
putFacemaskOnSale(id: number): void {
if (window.localStorage[PRODUCT_METADATA]) {
let facemaskMetadata: Metadata[] = JSON.parse(
window.localStorage[PRODUCT_METADATA]
);
if (id < facemaskMetadata.length) {
facemaskMetadata[id].isProductAdded = true;
window.localStorage[PRODUCT_METADATA] =
JSON.stringify(facemaskMetadata);
<li>
<app-basket></app-basket>
</li>