Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…V-Frontend into 105-header
  • Loading branch information
savioc2 committed Nov 14, 2023
2 parents b696506 + c6e1786 commit 9ada894
Show file tree
Hide file tree
Showing 54 changed files with 1,692 additions and 144 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Pipeline Frontend

on: push

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout ✅
uses: actions/checkout@v3

- name: Setup 🏗
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: 'npm'

- name: Install ⚙️
run: npm install

- name: Build 🛠
run: npm run build

- name: Test 📋
run: npm run test:prod
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: netlify-deploy
on:
pull_request:
types:
- closed
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout ✅
uses: actions/checkout@v3

- name: Setup 🏗
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: 'npm'

- name: Install ⚙️
run: npm install

- name: Build 🛠
run: npm run build

- name: Test 📋
run: npm run test:prod

- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './dist/unb-tv-frontend'
production-branch: devel
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ testem.log
Thumbs.db

./github
/src/app/secret/
/src/app/environment
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ FROM node:16 as angular

WORKDIR /unb-tv-web

RUN apt-get update
RUN apt-get -y install chromium

# set CHROME_BIN environment variable, so that karma knows which crome should be started
ENV CHROME_BIN=/usr/bin/chromium

ENV PATH /unb-tv-web/node_modules/.bin:$PATH
ENV NODE_ENV=dev

Expand Down
8 changes: 5 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/un-b-tv-frontend",
"outputPath": "dist/unb-tv-frontend",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
Expand All @@ -22,7 +22,8 @@
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
"src/_redirects"
],
"styles": [
"src/styles.css"
Expand Down Expand Up @@ -89,7 +90,8 @@
"styles": [
"src/styles.css"
],
"scripts": []
"scripts": [],
"karmaConfig": "karma.conf.js"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ services:
volumes:
- .:/unb-tv-web
- /unb-tv-web/node_modules
command: ng serve --host 0 --port 4200
command: ng serve --host 0 --port 4200 --poll 2000
52 changes: 52 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
'--no-sandbox',
'--disable-gpu',
'--headless',
'--remote-debugging-port=9222'
]
}
},
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/unb-tv-frontend'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'lcov' },
{ type: 'cobertura' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
browsers: ['Chrome'],
restartOnFileChange: true
});
};
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "un-b-tv-frontend",
"name": "unb-tv-frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"build:tailwind": "postcss src/styles.css -o dist/styles.css",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"build:prod": "ng build --prod",
"test:prod": "ng test --browsers=ChromeHeadless --watch=false --code-coverage"
},
"private": true,
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
9 changes: 8 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ import { LoginComponent } from './pages/login/login.component';
import { RegisterComponent } from './pages/register/register.component';
import { LoginSocialComponent } from './pages/login-social/login-social.component';
import { VideoComponent } from './pages/video/video.component';
import { VideoViewerComponent } from './pages/video/video-viewer.component';
import { VideoViewerComponent } from './pages/video-viewer/video-viewer.component';
import { ActiveAccountComponent } from './pages/active-account/active-account.component';
import { ProfileComponent } from './pages/profile/profile.component';
import { CheckCodeRestPasswordComponent } from './pages/check-code-rest-password/check-code-rest-password.component';
import { ResetPasswordComponent } from './pages/reset-password/reset-password.component';
import { AuthGuard } from './services/auth.guard';
import { EditUserComponent } from './pages/edit-user/edit-user.component';
<<<<<<< HEAD
import { ProgramacaoComponent } from './pages/programacao/programacao.component';
import { AgoraComponent } from './pages/agora/agora.component';
=======
import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.component';
import { ParticipateComponent } from './pages/participate/participate.component';
>>>>>>> c6e17862938e0f0a21bd8a1c130a93c1eb4e0b27

const routes: Routes = [
{ path: 'login', component: LoginComponent },
Expand All @@ -24,6 +29,8 @@ const routes: Routes = [
{ path: 'activeAccount', component: ActiveAccountComponent },
{ path: 'sendCodeResetPassword', component: CheckCodeRestPasswordComponent },
{ path: 'changePassword', component: ResetPasswordComponent },
{ path: 'suggestAgenda', component: SuggestAgendaComponent },
{ path: 'participate', component: ParticipateComponent },
{ path: 'profile', component: ProfileComponent, canActivate: [AuthGuard], },
{ path: 'editUser/:id', component: EditUserComponent, canActivate: [AuthGuard], },
{ path: '', component: HomePageComponent, canActivate: [AuthGuard], },
Expand Down
35 changes: 12 additions & 23 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
import { TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { BackgroundComponent } from './components/background/background.component';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
imports: [RouterTestingModule],
declarations: [AppComponent, BackgroundComponent],
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it(`should have as title 'UnB-TV-Frontend'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('UnB-TV-Frontend');
it('should create the app', () => {
expect(component).toBeTruthy();
});

// it('should render title', () => {
// const fixture = TestBed.createComponent(AppComponent);
// fixture.detectChanges();
// const compiled = fixture.nativeElement as HTMLElement;
// expect(compiled.querySelector('.content span')?.textContent).toContain('UnB-TV-Frontend app is running!');
// });
});
6 changes: 5 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AppComponent } from './app.component';
import { LoginComponent } from './pages/login/login.component';
import { RegisterComponent } from './pages/register/register.component';
import { VideoComponent } from './pages/video/video.component';
import { VideoViewerComponent } from './pages/video/video-viewer.component';
import { VideoViewerComponent } from './pages/video-viewer/video-viewer.component';
import { SafePipe } from './pipes/safe.pipe';
import { BackgroundComponent } from './components/background/background.component';
import { LoginSocialComponent } from './pages/login-social/login-social.component';
Expand All @@ -24,6 +24,8 @@ import { AuthService } from './services/auth.service';
import { EditUserComponent } from './pages/edit-user/edit-user.component';
import { AgoraComponent } from './pages/agora/agora.component';
import { ProgramacaoComponent } from './pages/programacao/programacao.component';
import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.component';
import { ParticipateComponent } from './pages/participate/participate.component';

@NgModule({
declarations: [
Expand All @@ -44,6 +46,8 @@ import { ProgramacaoComponent } from './pages/programacao/programacao.component'
EditUserComponent,
AgoraComponent,
ProgramacaoComponent,
SuggestAgendaComponent,
ParticipateComponent,
],
imports: [
BrowserModule,
Expand Down
28 changes: 21 additions & 7 deletions src/app/components/background/background.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,39 @@
</div>
<div class="flex flex-row items-center justify-center pb-10">
<div class="pr-2">
<img alt="form-unb" src="../../../assets/form-unb-tv.svg">
<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">
<img alt="telefone" src="../../../assets/telefone.svg">
<a href="https://unbtv.unb.br/contato" target="_blank">
<img alt="telefone" src="../../../assets/telefone.svg">
</a>
</div>
<div class="pr-2">
<img alt="website" src="../../../assets/website.svg">
<a href="https://unbtv.unb.br" target="_blank">
<img alt="website" src="../../../assets/website.svg">
</a>
</div>
<div class="pr-2">
<img alt="youtube" src="../../../assets/youtube.svg">
<a href="https://www.youtube.com/@UnBTV" target="_blank">
<img alt="youtube" src="../../../assets/youtube.svg">
</a>
</div>
<div class="pr-2">
<img alt="instagram" src="../../../assets/instagram.svg">
<a href="https://www.instagram.com/unbtv/" target="_blank">
<img alt="instagram" src="../../../assets/instagram.svg">
</a>
</div>
<div class="pr-2">
<img alt="facebook" src="../../../assets/facebook.svg">
<a href="https://www.facebook.com/UnBTV" target="_blank">
<img alt="facebook" src="../../../assets/facebook.svg">
</a>
</div>
<div class="pr-2">
<img alt="x" src="../../../assets/x.svg">
<a href="twitter.com/unb_tv" target="_blank">
<img alt="x" src="../../../assets/x.svg">
</a>
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion src/app/components/background/background.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { BackgroundComponent } from './background.component';
import { RouterTestingModule } from '@angular/router/testing';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ BackgroundComponent ]
declarations: [ BackgroundComponent ],
imports: [RouterTestingModule]
})
.compileComponents();

Expand Down
4 changes: 3 additions & 1 deletion src/app/environment/environment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const EDUPLAY_CLIENT_KEY = "a1cdba06226408fcda63b49c50223c68d56005d234cc98bcdc1ae787d2b4de1d";
export const environment = {
apiURL: 'http://localhost:8000/api'
usersAPIURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api',
adminAPIURL: 'https://admin-unb-tv-2023-2-dc0dd53d3aca.herokuapp.com/api'
};
Loading

0 comments on commit 9ada894

Please sign in to comment.