Skip to content

Commit

Permalink
Merge pull request #18 from fga-eps-mds/46-footer-fix
Browse files Browse the repository at this point in the history
46 footer fix
  • Loading branch information
joao15victor08 authored Nov 20, 2023
2 parents 5ae1f1e + 727121b commit 654d926
Show file tree
Hide file tree
Showing 12 changed files with 233 additions and 33 deletions.
5 changes: 2 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { ToastModule } from 'primeng/toast';
import { ConfirmDialogModule } from 'primeng/confirmdialog';
import { ConfirmationService } from 'primeng/api';
import { ConfirmationService, MessageService } from 'primeng/api';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc';
import { InputTextModule } from 'primeng/inputtext';
Expand Down Expand Up @@ -37,7 +37,6 @@ import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.co
import { ParticipateComponent } from './pages/participate/participate.component';
import { GridComponent } from './pages/grid/grid.component';
import { GridDaysComponent } from './pages/grid-days/grid-days.component';
import { MessageService } from 'primeng/api';
import { ProgressSpinnerModule } from 'primeng/progressspinner';

@NgModule({
Expand Down Expand Up @@ -92,4 +91,4 @@ import { ProgressSpinnerModule } from 'primeng/progressspinner';
],
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
67 changes: 47 additions & 20 deletions src/app/components/background/background.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,44 +32,71 @@
</div>
</nav>
</div>
<div class="flex-grow">
<div class="flex-grow p-3">
<ng-content></ng-content>
</div>
<div class="flex flex-row items-center justify-center pb-10 mt-20">
<div class="pr-2">
<a href="url_do_link_para_form-unb" target="_blank">
<img alt="form-unb" src="../../../assets/form-unb-tv.svg" />
</a>
</div>
<div class="pr-2">
<a href="https://unbtv.unb.br/contato" target="_blank">
<footer
class="flex flex-row items-center justify-center gap-3 py-6 px-3 md:py-10 mt-5"
>
<div>
<a
[href]="mobileDevide ? 'tel:+556131072775' : 'https://unbtv.unb.br/contato'"
target="_blank"
id="contact_link"
rel="noopener"
>
<img alt="telefone" src="../../../assets/telefone.svg" />
</a>
</div>
<div class="pr-2">
<a href="https://unbtv.unb.br" target="_blank">
<div>
<a
href="https://www.unbtv.unb.br"
target="_blank"
id="website_link"
rel="noopener"
>
<img alt="website" src="../../../assets/website.svg" />
</a>
</div>
<div class="pr-2">
<a href="https://www.youtube.com/@UnBTV" target="_blank">
<div>
<a
href="https://www.youtube.com/@UnBTV"
target="_blank"
id="youtube_link"
rel="noopener"
>
<img alt="youtube" src="../../../assets/youtube.svg" />
</a>
</div>
<div class="pr-2">
<a href="https://www.instagram.com/unbtv/" target="_blank">
<div>
<a
href="https://www.instagram.com/unbtv/"
target="_blank"
id="instagram_link"
rel="noopener"
>
<img alt="instagram" src="../../../assets/instagram.svg" />
</a>
</div>
<div class="pr-2">
<a href="https://www.facebook.com/UnBTV" target="_blank">
<div>
<a
href="https://www.facebook.com/UnBTV"
target="_blank"
id="facebook_link"
rel="noopener"
>
<img alt="facebook" src="../../../assets/facebook.svg" />
</a>
</div>
<div class="pr-2">
<a href="twitter.com/unb_tv" target="_blank">
<div>
<a
href="https://www.twitter.com/unb_tv"
target="_blank"
id="twitter_link"
rel="noopener"
>
<img alt="x" src="../../../assets/x.svg" />
</a>
</div>
</div>
</footer>
</div>
98 changes: 95 additions & 3 deletions src/app/components/background/background.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ describe('BackgroundComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [BackgroundComponent],
imports: [RouterTestingModule, MenuModule]
})
.compileComponents();
imports: [RouterTestingModule, MenuModule],
}).compileComponents();

fixture = TestBed.createComponent(BackgroundComponent);
component = fixture.componentInstance;
Expand All @@ -23,4 +22,97 @@ describe('BackgroundComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

describe('Identifies User Device', () => {
it('should identify a mobile device - Android', () => {
// mock userAgent for Android
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (Linux; Android 10; Pixel 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Mobile Safari/537.36',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeTruthy();
});

it('should identify a mobile device - iPhone', () => {
// mock userAgent for iPhone
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (iPhone; CPU iPhone OS 15_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.3 Mobile/15E148 Safari/604.1',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeTruthy();
});

it('should identify a mobile device - iPad', () => {
// mock userAgent for iPad
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (iPad; CPU OS 14_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeTruthy();
});

it('should identify a mobile device - iPod', () => {
// mock userAgent for iPod
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (iPod; CPU iPhone OS 14_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeTruthy();
});

it('should identify a mobile device - Windows Phone', () => {
// mock userAgent for Windows Phone
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1; Microsoft; Lumia 950 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Mobile Safari/537.36 Edge/13.10586',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeTruthy();
});

it('should identify a mobile device - BlackBerry', () => {
// mock userAgent for BlackBerry
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeTruthy();
});

it('should identify a non-mobile device', () => {
// mock userAgent
Object.defineProperty(navigator, 'userAgent', {
value:
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 OPR/104.0.0.0 (Edition std-1)',
configurable: true,
writable: true,
});

component.identifiesUserDevice();
expect(component.mobileDevide).toBeFalsy();
});
});
});
28 changes: 21 additions & 7 deletions src/app/components/background/background.component.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
import { Component, OnInit } from '@angular/core';
import { MenuItem, MessageService } from 'primeng/api';


@Component({
selector: 'app-background',
templateUrl: './background.component.html',
styleUrls: ['./background.component.css'],
providers: [MessageService]
providers: [MessageService],
})
export class BackgroundComponent implements OnInit {
items: MenuItem[] = [];
mobileDevide: boolean = true;

constructor(
) { }
constructor() {}

ngOnInit(): void {
this.items = [
{
label: 'Perfil',
routerLink: '/profile'
}
]
routerLink: '/profile',
},
];
this.identifiesUserDevice();
}

identifiesUserDevice(): void {
if (
RegExp(/Android/i).exec(navigator.userAgent) ||
RegExp(/iPhone/i).exec(navigator.userAgent) ||
RegExp(/iPad/i).exec(navigator.userAgent) ||
RegExp(/iPod/i).exec(navigator.userAgent) ||
RegExp(/BlackBerry/i).exec(navigator.userAgent) ||
RegExp(/Windows Phone/i).exec(navigator.userAgent)
) {
this.mobileDevide = true; // está utilizando dispositivo móvel
} else {
this.mobileDevide = false;
}
}
}
Empty file.
1 change: 1 addition & 0 deletions src/app/pages/agora/agora.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>agora works!</p>
23 changes: 23 additions & 0 deletions src/app/pages/agora/agora.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AgoraComponent } from './agora.component';

describe('AgoraComponent', () => {
let component: AgoraComponent;
let fixture: ComponentFixture<AgoraComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AgoraComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(AgoraComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/pages/agora/agora.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-agora',
templateUrl: './agora.component.html',
styleUrls: ['./agora.component.css']
})
export class AgoraComponent {

}
Empty file.
1 change: 1 addition & 0 deletions src/app/pages/programacao/programacao.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>programacao works!</p>
23 changes: 23 additions & 0 deletions src/app/pages/programacao/programacao.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ProgramacaoComponent } from './programacao.component';

describe('ProgramacaoComponent', () => {
let component: ProgramacaoComponent;
let fixture: ComponentFixture<ProgramacaoComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProgramacaoComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(ProgramacaoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions src/app/pages/programacao/programacao.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-programacao',
templateUrl: './programacao.component.html',
styleUrls: ['./programacao.component.css']
})
export class ProgramacaoComponent {

}

0 comments on commit 654d926

Please sign in to comment.