-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26d2c44
commit e796e6b
Showing
25 changed files
with
457 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
<p>feed works!</p> | ||
<section class="feed-container"> | ||
<CustomButton [buttonName]="'Write'" /> | ||
<h2 class="feed-title">News Feed</h2> | ||
<div class="feed-list"> | ||
<!-- Repeat this block for each post --> | ||
<div class="feed-item"> | ||
<div class="author-info"> | ||
<div class="author-image"></div> | ||
<div class="author-details"> | ||
<h3>Arjun Reddy</h3> | ||
<p class="time-stamp">10 mins ago</p> | ||
</div> | ||
</div> | ||
<p class="feed-content"> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. | ||
</p> | ||
<div class="feed-interaction"> | ||
<!-- Interaction buttons go here (like, comment, etc.) --> | ||
</div> | ||
</div> | ||
<!-- End of post block --> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@import "../../partials/variables"; | ||
|
||
.feed-container { | ||
max-width: 600px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.write-button { | ||
padding: 10px 20px; | ||
font-size: 0.9rem; | ||
} | ||
} | ||
|
||
.feed-title { | ||
color: #333; | ||
margin-top: 30px; | ||
text-align: center; | ||
} | ||
|
||
.feed-list { | ||
margin-top: 20px; | ||
} | ||
|
||
.feed-item { | ||
background: #fff; | ||
border-radius: 15px; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | ||
margin-bottom: 20px; | ||
padding: 20px; | ||
} | ||
|
||
.author-info { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.author-image { | ||
width: 50px; | ||
height: 50px; | ||
background-color: #ddd; // Replace with the author's image | ||
border-radius: 50%; | ||
margin-right: 10px; | ||
} | ||
|
||
.author-details { | ||
h3 { | ||
margin: 0; | ||
} | ||
.time-stamp { | ||
color: #999; | ||
font-size: 0.9em; | ||
} | ||
} | ||
|
||
.feed-content { | ||
color: #666; | ||
} | ||
|
||
// .feed-interaction { | ||
// // Add styles for interaction buttons | ||
// } | ||
|
||
// Responsive styling | ||
@media (max-width: 768px) { | ||
.feed-container { | ||
padding: 10px; | ||
} | ||
|
||
.write-button { | ||
padding: 8px 16px; | ||
} | ||
|
||
// Adjust other styles as needed for mobile responsiveness | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, inject } from '@angular/core'; | ||
import { Auth } from '@angular/fire/auth'; | ||
import { CustomButtonComponent } from '../shared/components/custom-button/custom-button.component'; | ||
|
||
@Component({ | ||
selector: 'app-feed', | ||
standalone: true, | ||
imports: [], | ||
imports: [CustomButtonComponent], | ||
templateUrl: './feed.component.html', | ||
styleUrl: './feed.component.scss' | ||
}) | ||
export class FeedComponent { | ||
|
||
auth: Auth = inject(Auth); | ||
|
||
ngOnInit() { | ||
console.log(this.auth.currentUser) | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
src/app/shared/components/custom-button/custom-button.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<button class="write-button">{{ buttonName }}</button> |
29 changes: 29 additions & 0 deletions
29
src/app/shared/components/custom-button/custom-button.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@import "../../../../partials/variables"; | ||
|
||
.write-button { | ||
background-color: $accent-color; | ||
color: white; | ||
border: none; | ||
padding: 12px 24px; | ||
font-size: 1rem; | ||
font-weight: 600; | ||
cursor: pointer; | ||
outline: none; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); | ||
transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s; | ||
display: inline-block; | ||
margin-top: 20px; | ||
} | ||
|
||
.write-button:hover, | ||
.write-button:focus { | ||
opacity: 0.7; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.write-button { | ||
padding: 10px 20px; | ||
font-size: 0.9rem; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/shared/components/custom-button/custom-button.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CustomButtonComponent } from './custom-button.component'; | ||
|
||
describe('CustomButtonComponent', () => { | ||
let component: CustomButtonComponent; | ||
let fixture: ComponentFixture<CustomButtonComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [CustomButtonComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(CustomButtonComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
src/app/shared/components/custom-button/custom-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component, Input, signal } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'CustomButton', | ||
standalone: true, | ||
imports: [], | ||
templateUrl: './custom-button.component.html', | ||
styleUrl: './custom-button.component.scss' | ||
}) | ||
export class CustomButtonComponent { | ||
|
||
@Input() buttonName = ""; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="full-page-loader"> | ||
<div class="logo-loader">BREVIPOST</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.full-page-loader { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(255, 255, 255, 0.8); | ||
z-index: 9999; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
@keyframes ellipsis { | ||
0%, | ||
100% { | ||
content: ""; | ||
} | ||
25% { | ||
content: "."; | ||
} | ||
50% { | ||
content: ".."; | ||
} | ||
75% { | ||
content: "..."; | ||
} | ||
} | ||
|
||
.logo-loader::after { | ||
content: ""; | ||
animation: ellipsis 2s infinite; | ||
} | ||
|
||
.logo-loader { | ||
font-size: 48px; | ||
font-weight: bold; | ||
color: transparent; | ||
font-family: "Luckiest", sans-serif; /* Ensure this font is loaded or choose an alternative */ | ||
-webkit-text-stroke: 1px #ed546b; | ||
background-image: repeating-linear-gradient( | ||
45deg, | ||
#ed546b, | ||
#ed546b 2px, | ||
transparent 2px, | ||
transparent 10px | ||
); | ||
-webkit-background-clip: text; | ||
background-clip: text; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { LoaderComponent } from './loader.component'; | ||
|
||
describe('LoaderComponent', () => { | ||
let component: LoaderComponent; | ||
let fixture: ComponentFixture<LoaderComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [LoaderComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(LoaderComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'Loader', | ||
standalone: true, | ||
imports: [], | ||
templateUrl: './loader.component.html', | ||
styleUrl: './loader.component.scss' | ||
}) | ||
export class LoaderComponent { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Injectable, inject } from '@angular/core'; | ||
import { Auth, GoogleAuthProvider, signInWithPopup } from '@angular/fire/auth'; | ||
import { Router } from '@angular/router'; | ||
import { Observable, of } from 'rxjs'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AuthService { | ||
|
||
constructor() { } | ||
private readonly auth: Auth = inject(Auth); | ||
private readonly router: Router = inject(Router); | ||
|
||
signInWithGoogle() { | ||
const provider = new GoogleAuthProvider(); | ||
signInWithPopup(this.auth, provider) | ||
.then((result) => { | ||
const credential = GoogleAuthProvider.credentialFromResult(result); | ||
this.router.navigateByUrl('/feed') | ||
}).catch((error) => { | ||
const credential = GoogleAuthProvider.credentialFromError(error); | ||
}); | ||
} | ||
|
||
isAuthenticated$(): Observable<boolean> { | ||
return of(this.auth.currentUser !== null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { CanActivateFn } from '@angular/router'; | ||
|
||
import { authGuard } from './auth.guard'; | ||
|
||
describe('authGuard', () => { | ||
const executeGuard: CanActivateFn = (...guardParameters) => | ||
TestBed.runInInjectionContext(() => authGuard(...guardParameters)); | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(executeGuard).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { inject } from '@angular/core'; | ||
import { CanActivateFn, Router } from '@angular/router'; | ||
import { take, tap, } from 'rxjs'; | ||
import { AuthService } from '../auth/auth.service'; | ||
|
||
export const authGuard: CanActivateFn = (route, state) => { | ||
|
||
const authService = inject(AuthService); | ||
const router = inject(Router); | ||
|
||
return authService.isAuthenticated$().pipe( | ||
take(1), | ||
tap((isAuthenticated: boolean) => { | ||
if (!isAuthenticated) { | ||
router.navigateByUrl('/sign-in'); | ||
} | ||
}) | ||
); | ||
}; |
Oops, something went wrong.