Skip to content

Instantly share code, notes, and snippets.

@hieptlccc
hieptlccc / login.component.ts
Created October 7, 2022 11:53
1 on 1 Angular Chat - login.component.ts
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { Router } from '@angular/router';
import { CometChat } from '@cometchat-pro/chat';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css'],
@hieptlccc
hieptlccc / register.component.html
Created October 7, 2022 05:08
1 on 1 Angular Chat - register.component.html
<div class="app">
<div class="login-page">
<div class="form">
<img class="header__logo" src="/assets/logo.svg" alt="youtube logo" />
<form
class="login-form"
class="login-form"
#loginForm="ngForm"
(ngSubmit)="submit(loginForm.value)"
>
@hieptlccc
hieptlccc / register.component.css
Created October 7, 2022 05:07
1 on 1 Angular Chat - register.component.css
@import url(https://fonts.googleapis.com/css?family=Roboto:300);
.login-page {
width: 360px;
padding: 8% 0 0;
margin: auto;
}
.form {
position: relative;
z-index: 1;
@hieptlccc
hieptlccc / register.component.ts
Created October 7, 2022 05:07
1 on 1 Angular Chat - register.component.ts
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { Router } from '@angular/router';
import { CometChat } from '@cometchat-pro/chat';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.css'],
@hieptlccc
hieptlccc / app.module.ts
Created October 7, 2022 05:06
1 on 1 Angular Chat - app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { environment } from 'src/environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ChatComponent } from './chat/chat.component'
@hieptlccc
hieptlccc / app.component.html
Created October 7, 2022 05:05
1 on 1 Angular Chat - app.component.html
<router-outlet></router-outlet>
@hieptlccc
hieptlccc / app-routing.module.ts
Created October 7, 2022 05:04
1 on 1 Angular Chat - app-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {
AngularFireAuthGuard,
redirectUnauthorizedTo,
} from '@angular/fire/auth-guard';
const redirectUnauthorizedToLogin = () => redirectUnauthorizedTo(['login']);
import { ChatComponent } from './chat/chat.component';
@hieptlccc
hieptlccc / app.config.ts
Created October 7, 2022 05:02
1 on 1 Angular Chat - app.config.ts
const firebaseConfig = {
apiKey: 'xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx',
authDomain: 'xxx-xxx-xxx-xxx-xxx-xxx-xxx',
databaseURL: 'xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx',
projectId: 'xxx-xxx-xxx',
storageBucket: 'xxx-xxx-xxx-xxx-xxx',
messagingSenderId: 'xxx-xxx-xxx',
appId: 'xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx',
measurementId: 'xxx-xxx-xxx',
};
@hieptlccc
hieptlccc / environment.ts
Created October 7, 2022 05:01
1 on 1 Angular Chat - environment.ts
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
import { firebaseConfig, cometChat } from './../../app.config'
export const environment = {
production: false,
firebase: firebaseConfig,
...cometChat,
};
@hieptlccc
hieptlccc / index.js
Created October 6, 2022 11:04
Live Chat Widget React - index.js
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
ReactDOM.render(<App />, document.getElementById("root"));