Skip to content

Commit

Permalink
Merge pull request #41 from fga-eps-mds/118-catalogo-programas
Browse files Browse the repository at this point in the history
Catálogo de programação
  • Loading branch information
nYCSTs authored Dec 11, 2023
2 parents 65d6b14 + 11f5f78 commit 06a0c3d
Show file tree
Hide file tree
Showing 48 changed files with 1,941 additions and 378 deletions.
71 changes: 56 additions & 15 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,74 @@ import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.co
import { ParticipateComponent } from './pages/participate/participate.component';
import { GridDaysComponent } from './pages/grid-days/grid-days.component';
import { GridComponent } from './pages/grid/grid.component';
import { CatalogComponent } from './pages/catalog/catalog.component';

import { WithTokenGuard } from './guard/with-token.guard';

const routes: Routes = [
{ path: 'stream', component: StreamViewComponent },
{ path: 'catalog', component: CatalogComponent },
{ path: 'videos', component: VideoComponent },
{ path: 'video/:idVideo', component: VideoViewerComponent },
{ path: '', component: VideoComponent, canActivate: [AuthGuard], },
{ path: 'login', component: LoginComponent, canActivate: [WithTokenGuard], },
{ path: 'register', component: RegisterComponent, canActivate: [WithTokenGuard], },
{ path: 'loginsocial', component: LoginSocialComponent, canActivate: [WithTokenGuard], },
{ path: 'sendCodeResetPassword', component: CheckCodeRestPasswordComponent, canActivate: [WithTokenGuard], },
{ path: 'changePassword', component: ResetPasswordComponent, canActivate: [WithTokenGuard], },
{ path: 'videos', component: VideoComponent, canActivate: [AuthGuard], },
{ path: 'video/:idVideo', component: VideoViewerComponent, canActivate: [AuthGuard], },
{ path: 'activeAccount', component: ActiveAccountComponent, canActivate: [WithTokenGuard], },
{ path: 'suggestAgenda', component: SuggestAgendaComponent, canActivate: [AuthGuard], },
{ path: 'participate', component: ParticipateComponent, canActivate: [AuthGuard], },
{ path: 'profile', component: ProfileComponent, canActivate: [AuthGuard], },
{ path: 'editUser/:id', component: EditUserComponent, canActivate: [AuthGuard], },
{ path: '', component: CatalogComponent },
{ path: 'login', component: LoginComponent, canActivate: [WithTokenGuard] },
{
path: 'register',
component: RegisterComponent,
canActivate: [WithTokenGuard],
},
{
path: 'loginsocial',
component: LoginSocialComponent,
canActivate: [WithTokenGuard],
},
{
path: 'sendCodeResetPassword',
component: CheckCodeRestPasswordComponent,
canActivate: [WithTokenGuard],
},
{
path: 'changePassword',
component: ResetPasswordComponent,
canActivate: [WithTokenGuard],
},
{
path: 'video/:idVideo',
component: VideoViewerComponent,
canActivate: [AuthGuard],
},
{
path: 'activeAccount',
component: ActiveAccountComponent,
canActivate: [WithTokenGuard],
},
{
path: 'suggestAgenda',
component: SuggestAgendaComponent,
canActivate: [AuthGuard],
},
{
path: 'participate',
component: ParticipateComponent,
canActivate: [AuthGuard],
},
{ path: 'profile', component: ProfileComponent, canActivate: [AuthGuard] },
{
path: 'editUser/:id',
component: EditUserComponent,
canActivate: [AuthGuard],
},
{ path: 'grid-days', component: GridDaysComponent },
{ path: 'grid-days/:day', component: GridComponent },
{ path: 'update-role', component: UpdateRoleComponent, canActivate: [AdminGuard], }
{
path: 'update-role',
component: UpdateRoleComponent,
canActivate: [AdminGuard],
},
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
5 changes: 4 additions & 1 deletion src/app/app.constant.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const EDUPLAY_API_URL = 'https://eduplay.rnp.br/services/';
export const UNB_ID = 216;
export const UNB_ID = 216;
export const VIDEOS_LIMIT = 1000;
export const VIDEOS_ORDER = 3; // ordenação pelos mais recentes (eduplay);
export const UNB_TV_CHANNEL_ID = 190265;
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { GridComponent } from './pages/grid/grid.component';
import { GridDaysComponent } from './pages/grid-days/grid-days.component';
import { ProgressSpinnerModule } from 'primeng/progressspinner';
import { NgxGoogleAnalyticsModule, NgxGoogleAnalyticsRouterModule } from 'ngx-google-analytics';
import { CatalogComponent } from './pages/catalog/catalog.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -85,7 +86,8 @@ import { NgxGoogleAnalyticsModule, NgxGoogleAnalyticsRouterModule } from 'ngx-go
ParticipateComponent,
GridComponent,
GridDaysComponent,
VideoCommentComponent
VideoCommentComponent,
CatalogComponent
],

providers: [
Expand Down
120 changes: 63 additions & 57 deletions src/app/components/background/background.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,67 @@
<div class="pt-10 flex justify-center items-center">
<img alt="simbolo-unb" src="../../../assets/Simbolo_UnBTV-01 1.png" />
</div>
<div *ngIf="getActualRoute() !== '/login' && getActualRoute() !== '/loginsocial'">
<nav class="flex flex-row items-center justify-center pl-3">
<ul class="flex flex-row gap-1 text-xs">
<div *ngIf="getActualRoute() === '/stream'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/stream']">Agora na TV</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/stream'">
<li class="text-blue-brand">
<a [routerLink]="['/stream']">Agora na TV</a>
</li>
</div>
<div class="mx-2 text-blue-brand">|</div>
<div *ngIf="getActualRoute() === '/videos'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/videos']">Catálogo</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/videos'">
<li class="text-blue-brand" >
<a [routerLink]="['/videos']">Catálogo</a>
</li>
</div>
<div class="mx-2 text-blue-brand">|</div>
<div *ngIf="getActualRoute() === '/grid-days'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/grid-days']">Programação</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/grid-days'">
<li class="text-blue-brand">
<a [routerLink]="['/grid-days']">Programação</a>
</li>
</div>
<div class="mx-2 text-blue-brand">|</div>
<div *ngIf="getActualRoute() === '/participate'" >
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/participate']">Participe</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/participate'" >
<li class="text-blue-brand">
<a [routerLink]="['/participate']">Participe</a>
</li>
<div
*ngIf="
getActualRoute() !== '/login' && getActualRoute() !== '/loginsocial'
"
>
<nav class="flex flex-row items-center justify-center pl-3">
<ul class="flex flex-row gap-1 text-xs">
<div *ngIf="getActualRoute() === '/stream'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/stream']">Agora na TV</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/stream'">
<li class="text-blue-brand">
<a [routerLink]="['/stream']">Agora na TV</a>
</li>
</div>
</ul>
<div class="card flex justify-content-center mx-2">
<p-menu #menu [model]="items" [popup]="true"></p-menu>
<button
pButton
type="button"
(click)="menu.toggle($event)"
label="&#9776;"
></button>
</div>
</nav>
<div class="mx-2 text-blue-brand">|</div>
<div *ngIf="getActualRoute() === '/catalog'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/catalog']">Catálogo</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/catalog'">
<li class="text-blue-brand">
<a [routerLink]="['/catalog']">Catálogo</a>
</li>
</div>
<div class="mx-2 text-blue-brand">|</div>
<div *ngIf="getActualRoute() === '/grid-days'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/grid-days']">Programação</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/grid-days'">
<li class="text-blue-brand">
<a [routerLink]="['/grid-days']">Programação</a>
</li>
</div>
<div class="mx-2 text-blue-brand">|</div>
<div *ngIf="getActualRoute() === '/participate'">
<li class="font-bold text-[#00A550]">
<a [routerLink]="['/participate']">Participe</a>
</li>
</div>
<div *ngIf="getActualRoute() !== '/participate'">
<li class="text-blue-brand">
<a [routerLink]="['/participate']">Participe</a>
</li>
</div>
</ul>
<div class="card flex justify-content-center mx-2">
<p-menu #menu [model]="items" [popup]="true"></p-menu>
<button
pButton
type="button"
(click)="menu.toggle($event)"
label="&#9776;"
></button>
</div>
</nav>
</div>
</div>
<div class="flex-grow p-3">
Expand All @@ -70,7 +74,9 @@
>
<div>
<a
[href]="mobileDevide ? 'tel:+556131072775' : 'https://unbtv.unb.br/contato'"
[href]="
mobileDevide ? 'tel:+556131072775' : 'https://unbtv.unb.br/contato'
"
target="_blank"
id="contact_link"
rel="noopener"
Expand Down
17 changes: 10 additions & 7 deletions src/app/guard/with-token.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ describe('WithTokenGuard', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule.withRoutes(
[{ path: 'videos', component: VideoComponent }]
)], providers: [WithTokenGuard], declarations: [VideoComponent]
imports: [
HttpClientTestingModule,
RouterTestingModule.withRoutes([
{ path: 'catalog', component: VideoComponent },
]),
],
providers: [WithTokenGuard],
declarations: [VideoComponent],
});
guard = TestBed.inject(WithTokenGuard);
});
Expand All @@ -24,12 +29,10 @@ describe('WithTokenGuard', () => {
it('should return false for a logged in user', () => {
localStorage.setItem('token', 'testtoken');
expect(guard.canActivate()).toBe(false);
}
);
});

it('should return true for a logged out user', () => {
localStorage.removeItem('token');
expect(guard.canActivate()).toBe(true);
}
);
});
});
4 changes: 2 additions & 2 deletions src/app/guard/with-token.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CanActivate, Router } from '@angular/router';
import { AuthService } from '../services/auth.service';

@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class WithTokenGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) {}
Expand All @@ -12,7 +12,7 @@ export class WithTokenGuard implements CanActivate {
if (!this.authService.isAuthenticated()) {
return true;
} else {
this.router.navigate(['/videos']);
this.router.navigate(['/catalog']);
return false;
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/app/pages/catalog/catalog.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.center {
margin: 0 auto;
}

.thumbnail:hover {
box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}
Loading

0 comments on commit 06a0c3d

Please sign in to comment.