Initial commit

This commit is contained in:
Jānis Kacēns
2024-04-10 12:17:24 +03:00
parent 7ebb28f72a
commit 3889e684b4
152 changed files with 27501 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false
[*.{razor,cshtml}]
charset = utf-8-bom
+40
View File
@@ -0,0 +1,40 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/dist-server
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
+27
View File
@@ -0,0 +1,27 @@
# ImageMagick.UI
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.2.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
+143
View File
@@ -0,0 +1,143 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"PosterMaker.UI": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"progress": false,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"allowedCommonJsDependencies": [
"oidc-client"
],
"assets": [
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/deeppurple-amber.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "1mb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "PosterMaker.UI:build:production"
},
"development": {
"browserTarget": "PosterMaker.UI:build:development",
"proxyConfig": "proxy.conf.js"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "PosterMaker.UI:build"
"browserTarget": "PosterMaker.UI:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/assets"
],
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"@angular/material/prebuilt-themes/deeppurple-amber.css",
"src/styles.css"
],
"scripts": []
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist-server",
"main": "src/main.ts",
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"dev": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": true
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false
}
}
}
}
}
},
"defaultProject": "PosterMaker.UI",
"cli": {
"analytics": false
}
}
@@ -0,0 +1,33 @@
// This script sets up HTTPS for the application using the ASP.NET Core HTTPS certificate
const fs = require('fs');
const spawn = require('child_process').spawn;
const path = require('path');
const baseFolder =
process.env.APPDATA !== undefined && process.env.APPDATA !== ''
? `${process.env.APPDATA}/ASP.NET/https`
: `${process.env.HOME}/.aspnet/https`;
const certificateArg = process.argv.map(arg => arg.match(/--name=(?<value>.+)/i)).filter(Boolean)[0];
const certificateName = certificateArg ? certificateArg.groups.value : process.env.npm_package_name;
if (!certificateName) {
console.error('Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.')
process.exit(-1);
}
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
spawn('dotnet', [
'dev-certs',
'https',
'--export-path',
certFilePath,
'--format',
'Pem',
'--no-password',
], { stdio: 'inherit', })
.on('exit', (code) => process.exit(code));
}
+44
View File
@@ -0,0 +1,44 @@
// 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({
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/angularapp'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
File diff suppressed because it is too large Load Diff
+57
View File
@@ -0,0 +1,57 @@
{
"name": "postermaker.ui",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"prestart": "node aspnetcore-https",
"start": "run-script-os",
"start:windows": "ng serve --port 44404 --ssl --ssl-cert \"%APPDATA%\\ASP.NET\\https\\%npm_package_name%.pem\" --ssl-key \"%APPDATA%\\ASP.NET\\https\\%npm_package_name%.key\"",
"start:default": "ng serve --port 44404 --ssl --ssl-cert \"$HOME/.aspnet/https/${npm_package_name}.pem\" --ssl-key \"$HOME/.aspnet/https/${npm_package_name}.key\"",
"build": "ng build",
"build:ssr": "ng run PosterMaker.UI:server:dev",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.2.8",
"@angular/cdk": "^15.2.9",
"@angular/common": "^15.2.8",
"@angular/compiler": "^15.2.8",
"@angular/core": "^15.2.8",
"@angular/forms": "^15.2.8",
"@angular/material": "^15.2.9",
"@angular/platform-browser": "^15.2.8",
"@angular/platform-browser-dynamic": "^15.2.8",
"@angular/platform-server": "^15.2.8",
"@angular/router": "^15.2.8",
"bootstrap": "^5.3.1",
"jquery": "^3.6.4",
"oidc-client": "^1.11.5",
"popper.js": "^1.16.0",
"process": "^0.11.10",
"run-script-os": "^1.1.6",
"rxjs": "~7.8.1",
"tslib": "^2.5.0",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.2.7",
"@angular/cli": "^15.2.7",
"@angular/compiler-cli": "^15.2.8",
"@types/jasmine": "~4.3.1",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^18.16.3",
"jasmine-core": "~4.6.0",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"typescript": "~4.9.5"
},
"overrides": {
"autoprefixer": "10.4.5",
"webpack": "5.81.0"
}
}
+20
View File
@@ -0,0 +1,20 @@
const { env } = require('process');
const target = env.ASPNETCORE_HTTPS_PORT ? `https://localhost:${env.ASPNETCORE_HTTPS_PORT}` :
env.ASPNETCORE_URLS ? env.ASPNETCORE_URLS.split(';')[0] : 'http://localhost:1384';
const PROXY_CONFIG = [
{
context: [
"/poster",
],
proxyTimeout: 10000,
target: target,
secure: false,
headers: {
Connection: 'Keep-Alive'
}
}
]
module.exports = PROXY_CONFIG;
@@ -0,0 +1,6 @@
<body>
<app-nav-menu></app-nav-menu>
<main class="container">
<router-outlet></router-outlet>
</main>
</body>
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
title = 'app';
}
@@ -0,0 +1,50 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { NavMenuComponent } from './nav-menu/nav-menu.component';
import { HomeComponent } from './home/home.component';
import { MovieComponent } from "./movie/movie.component";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { MatSelectModule } from "@angular/material/select";
import {CollectionComponent} from "./collection/collection.component";
import {SeriesComponent} from "./series/series.component";
import {MatFormFieldModule} from "@angular/material/form-field";
import {MatCheckboxModule} from "@angular/material/checkbox";
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
HomeComponent,
MovieComponent,
CollectionComponent,
SeriesComponent
],
imports: [
BrowserModule.withServerTransition({appId: 'ng-cli-universal'}),
HttpClientModule,
FormsModule,
RouterModule.forRoot([
{path: '', component: HomeComponent, pathMatch: 'full'},
{path: 'movies', component: MovieComponent},
{path: 'collection', component: CollectionComponent},
{path: 'series', component: SeriesComponent}
]),
BrowserAnimationsModule,
MatInputModule,
MatButtonModule,
MatSelectModule,
ReactiveFormsModule,
MatFormFieldModule,
MatCheckboxModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
@NgModule({
imports: [AppModule, ServerModule],
bootstrap: [AppComponent]
})
export class AppServerModule { }
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body style="background-color: #e0d6ce">
<div class="container-xxl" style="background-color: #e0d6ce">
<div class="row">
<div class="col-lg-6">
<h2>Inputs</h2>
<form>
<mat-form-field appearance="fill">
<mat-label>Title:</mat-label>
<input matInput type="text" id="title" name="title" [(ngModel)]="title">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Second line of title:</mat-label>
<input matInput type="text" id="title2" name="title2" [(ngModel)]="title2">
</mat-form-field>
<br>
<div>
<input type="file" #file style="display: none;" (change)="onFileSelected($event)">
<button mat-raised-button color="primary" (click)="file.click()">Upload</button>
<button mat-raised-button color="primary" style="margin-left: 5px" (click)="onUpload()">Process</button></div>
</form>
</div>
<div class="col-lg-6" >
<div *ngIf="retrievedImage">
<h2>Image</h2>
<img [src]="retrievedImage" alt="Upload Image" [style.height.px]="windowHeight">
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,55 @@
import { Component, HostListener } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormControl } from "@angular/forms";
@Component({
selector: 'app-collection',
templateUrl: './collection.component.html',
})
export class CollectionComponent {
selectedFile: File | null = null;
retrievedImage: any;
base64Data: any;
retrieveResponse: any;
message: string | undefined;
windowHeight: number = window.innerHeight - 200;
title: any;
title2: any;
selectedLogoControl = new FormControl();
logoOptionControl = new FormControl();
constructor(private http: HttpClient)
{
this.onResize();
}
onFileSelected(event: Event) {
const element = event.target as HTMLInputElement;
let files = element.files;
this.selectedFile = files && files.length > 0 ? files[0] : null;
}
onUpload() {
if (!this.selectedFile) {
console.log('No file selected');
return;
}
const fd = new FormData();
fd.append('image', this.selectedFile, this.selectedFile.name);
fd.append('title', this.title);
fd.append('title2', this.title2);
this.http.post('https://localhost:44369/poster/collection', fd)
.subscribe(res => {
console.log(res);
this.retrieveResponse = res;
this.base64Data = this.retrieveResponse.picBytes;
this.retrievedImage = 'data:image/jpeg;base64,' + this.base64Data;
});
}
@HostListener('window:resize')
onResize() {
this.windowHeight = window.innerHeight - 200;
}
}
@@ -0,0 +1,14 @@
<h1>Hello, world!</h1>
<p>Welcome to your new single-page application, built with:</p>
<ul>
<li><a href='https://get.asp.net/'>ASP.NET Core</a> and <a href='https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx'>C#</a> for cross-platform server-side code</li>
<li><a href='https://angular.io/'>Angular</a> and <a href='http://www.typescriptlang.org/'>TypeScript</a> for client-side code</li>
<li><a href='http://getbootstrap.com/'>Bootstrap</a> for layout and styling</li>
</ul>
<p>To help you get started, we've also set up:</p>
<ul>
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
<li><strong>Angular CLI integration</strong>. In development mode, there's no need to run <code>ng serve</code>. It runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.</li>
<li><strong>Efficient production builds</strong>. In production mode, development-time features are disabled, and your <code>dotnet publish</code> configuration automatically invokes <code>ng build</code> to produce minified, ahead-of-time compiled JavaScript files.</li>
</ul>
<p>The <code>ClientApp</code> subdirectory is a standard Angular CLI application. If you open a command prompt in that directory, you can run any <code>ng</code> command (e.g., <code>ng test</code>), or use <code>npm</code> to install extra packages into it.</p>
@@ -0,0 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
})
export class HomeComponent {
}
@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body style="background-color: #e0d6ce">
<div class="container-xxl" style="background-color: #e0d6ce">
<div class="row">
<div class="col-lg-6">
<h2>Inputs</h2>
<form>
<mat-form-field appearance="fill">
<mat-label>Top Subtitle:</mat-label>
<input matInput type="text" id="topSubtitle" name="topSubtitle" [(ngModel)]="topSubtitle">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Title:</mat-label>
<input matInput type="text" id="title" name="title" [(ngModel)]="title">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Second line of title:</mat-label>
<input matInput type="text" id="title2" name="title2" [(ngModel)]="title2">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Subtitle:</mat-label>
<input matInput type="text" id="subtitle" name="subtitle" [(ngModel)]="subtitle">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Index:</mat-label>
<input matInput type="text" id="index" name="index" [(ngModel)]="index">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Select a Movie Logo</mat-label>
<mat-select [formControl]="selectedLogoControl">
<mat-option [value]="null">No Selection</mat-option>
<mat-option *ngFor="let logo of movieLogos | keyvalue" [value]="logo.key">{{ logo.value }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="selectedLogoControl.value" appearance="fill">
<mat-label>Select a logo </mat-label>
<mat-select [formControl]="logoOptionControl">
<mat-option *ngFor="let option of logoOptions | keyvalue" [value]="option.key">{{ option.value }}</mat-option>
</mat-select>
</mat-form-field>
<br>
<div>
<input type="file" #file style="display: none;" (change)="onFileSelected($event)">
<button mat-raised-button color="primary" (click)="file.click()">Upload</button>
<button mat-raised-button color="primary" style="margin-left: 5px" (click)="onUpload()">Process</button></div>
</form>
</div>
<div class="col-lg-6" >
<div *ngIf="retrievedImage">
<h2>Image</h2>
<img [src]="retrievedImage" alt="Upload Image" [style.height.px]="windowHeight">
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,70 @@
import { Component, HostListener } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { LogoOptions, MovieLogos } from './movie.enum';
import { FormControl } from "@angular/forms";
@Component({
selector: 'app-movie',
templateUrl: './movie.component.html',
})
export class MovieComponent {
selectedFile: File | null = null;
retrievedImage: any;
base64Data: any;
retrieveResponse: any;
message: string | undefined;
windowHeight: number = window.innerHeight - 200;
topSubtitle: any;
title: any;
title2: any;
subtitle: any;
index: any;
movieLogos = MovieLogos;
logoOptions = LogoOptions
selectedLogoControl = new FormControl();
logoOptionControl = new FormControl();
constructor(private http: HttpClient)
{
this.onResize();
}
onFileSelected(event: Event) {
const element = event.target as HTMLInputElement;
let files = element.files;
this.selectedFile = files && files.length > 0 ? files[0] : null;
}
onUpload() {
if (!this.selectedFile) {
console.log('No file selected');
return;
}
const fd = new FormData();
fd.append('image', this.selectedFile, this.selectedFile.name);
fd.append('topSubtitle', this.topSubtitle);
fd.append('title', this.title);
fd.append('subtitle', this.subtitle);
fd.append('index', this.index);
fd.append('title2', this.title2);
if (this.selectedLogoControl.value != null){
fd.append('logo', this.selectedLogoControl.value);
}
if (this.logoOptionControl.value != null) {
fd.append('logoOption', this.logoOptionControl.value);
}
this.http.post('https://localhost:44369/poster/movie', fd)
.subscribe(res => {
console.log(res);
this.retrieveResponse = res;
this.base64Data = this.retrieveResponse.picBytes;
this.retrievedImage = 'data:image/jpeg;base64,' + this.base64Data;
});
}
@HostListener('window:resize')
onResize() {
this.windowHeight = window.innerHeight - 200;
}
}
@@ -0,0 +1,15 @@
export enum MovieLogos {
A24 = "A24",
MarvelStudios = "Marvel Studios",
Disney = "Disney",
DC = "DC",
SonyPicturesAnimation = "Sony Pictures Animation",
Dreamworkds = "Dreamworks",
DisneyPixar = "Disney Pixar"
}
export enum LogoOptions {
None = "None",
White = "White",
Black = "Black"
}
@@ -0,0 +1,18 @@
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
@@ -0,0 +1,44 @@
<header>
<nav
class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3"
>
<div class="container">
<a class="navbar-brand" [routerLink]="['/']">PosterMaker</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target=".navbar-collapse"
aria-label="Toggle navigation"
[attr.aria-expanded]="isExpanded"
(click)="toggle()"
>
<span class="navbar-toggler-icon"></span>
</button>
<div
class="navbar-collapse collapse d-sm-inline-flex justify-content-end"
[ngClass]="{ show: isExpanded }"
>
<ul class="navbar-nav flex-grow">
<li
class="nav-item"
[routerLinkActive]="['link-active']"
[routerLinkActiveOptions]="{ exact: true }"
>
<a class="nav-link text-dark" [routerLink]="['/']">Home</a>
</li>
<li class="nav-item" [routerLinkActive]="['link-active']">
<a class="nav-link text-dark" [routerLink]="['/movies']">Movies</a>
</li>
<li class="nav-item" [routerLinkActive]="['link-active']">
<a class="nav-link text-dark" [routerLink]="['/collection']">Collection</a>
</li>
<li class="nav-item" [routerLinkActive]="['link-active']">
<a class="nav-link text-dark" [routerLink]="['/series']">Series</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
@@ -0,0 +1,18 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-nav-menu',
templateUrl: './nav-menu.component.html',
styleUrls: ['./nav-menu.component.css']
})
export class NavMenuComponent {
isExpanded = false;
collapse() {
this.isExpanded = false;
}
toggle() {
this.isExpanded = !this.isExpanded;
}
}
@@ -0,0 +1,36 @@
export enum MovieLogos {
A24 = "A24",
MarvelStudios = "Marvel Studios",
Disney = "Disney",
DC = "DC",
SonyPicturesAnimation = "Sony Pictures Animation",
Dreamworks = "Dreamworks",
DisneyPixar = "Disney Pixar"
}
export enum NetworkLogos {
Netflix= "Netflix",
DisneyPlus = "Disney+",
AppleTv = "Apple TV+",
Hbo = "HBO",
Fxx = "FXX",
Cbs = "CBS",
Peacock = "Peacock",
AmazonPrimeVideo = "Amazon Prime Video",
Nbc = "NBC",
Amc = "AMC",
Starz = "Starz",
Hulu = "Hulu",
Cw = "CW",
ParamountPlus = "Paramount+",
ComedyCentral = "Comedy Central",
Abc = "ABC",
Bbc = "BBC",
Usa = "USA",
Tbs = "TBS",
Fx = "FX",
AdultSwim = "Adult Swim",
Max = "Max",
Mtv = "Mtv",
ChannelFour = "ChannelFour"
}
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body style="background-color: #e0d6ce">
<div class="container-xxl" style="background-color: #e0d6ce">
<div class="row">
<div class="col-lg-6">
<h2>Inputs</h2>
<form>
<mat-form-field appearance="fill">
<mat-label>Top Subtitle:</mat-label>
<input matInput type="text" id="topSubtitle" name="topSubtitle" [(ngModel)]="topSubtitle">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Title:</mat-label>
<input matInput type="text" id="title" name="title" [(ngModel)]="title">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Second line of title:</mat-label>
<input matInput type="text" id="title2" name="title2" [(ngModel)]="title2">
</mat-form-field>
<br>
<br>
<mat-form-field appearance="fill">
<mat-label>Season number</mat-label>
<input matInput type="text" id="season" name="season" [(ngModel)]="season">
</mat-form-field>
<mat-checkbox id="isLimitedSeries" name="isLimitedSeries" [(ngModel)]="isLimitedSeries">Limited Series</mat-checkbox>
<br>
<mat-form-field appearance="fill">
<mat-label>Subtitle:</mat-label>
<input matInput type="text" id="subtitle" name="subtitle" [(ngModel)]="subtitle">
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Select a Network Logo</mat-label>
<mat-select [formControl]="selectedLogoControl">
<mat-option [value]="null">No Selection</mat-option>
<mat-option *ngFor="let logo of networkLogos | keyvalue" [value]="logo.key">{{ logo.value }}</mat-option>
</mat-select>
</mat-form-field>
<br>
<mat-form-field *ngIf="selectedLogoControl.value" appearance="fill">
<mat-label>Select a logo </mat-label>
<mat-select [formControl]="logoOptionControl">
<mat-option *ngFor="let option of logoOptions | keyvalue" [value]="option.key">{{ option.value }}</mat-option>
</mat-select>
</mat-form-field>
<br>
<mat-form-field appearance="fill">
<mat-label>Select a Studio Logo</mat-label>
<mat-select [formControl]="selectedStudioControl">
<mat-option [value]="null">No Selection</mat-option>
<mat-option *ngFor="let logo of studioLogos | keyvalue" [value]="logo.key">{{ logo.value }}</mat-option>
</mat-select>
</mat-form-field>
<div>
<input type="file" #file style="display: none;" (change)="onFileSelected($event)">
<button mat-raised-button color="primary" (click)="file.click()">Upload</button>
<button mat-raised-button color="primary" style="margin-left: 5px" (click)="onUpload()">Process</button></div>
</form>
</div>
<div class="col-lg-6" >
<div *ngIf="retrievedImage">
<h2>Image</h2>
<img [src]="retrievedImage" alt="Upload Image" [style.height.px]="windowHeight">
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,79 @@
import { Component, HostListener } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormControl } from "@angular/forms";
import {MovieLogos, NetworkLogos} from "./networks.enum";
import {LogoOptions} from "../movie/movie.enum";
@Component({
selector: 'app-collection',
templateUrl: './series.component.html',
})
export class SeriesComponent {
selectedFile: File | null = null;
retrievedImage: any;
base64Data: any;
retrieveResponse: any;
message: string | undefined;
windowHeight: number = window.innerHeight - 200;
title: any;
title2: any;
season: any;
subtitle: any;
topSubtitle: any;
networkLogos = NetworkLogos;
studioLogos = MovieLogos;
logoOptions = LogoOptions;
selectedLogoControl = new FormControl();
logoOptionControl = new FormControl();
selectedStudioControl = new FormControl();
isLimitedSeries: any;
constructor(private http: HttpClient)
{
this.onResize();
}
onFileSelected(event: Event) {
const element = event.target as HTMLInputElement;
let files = element.files;
this.selectedFile = files && files.length > 0 ? files[0] : null;
}
onUpload() {
if (!this.selectedFile) {
console.log('No file selected');
return;
}
const fd = new FormData();
fd.append('image', this.selectedFile, this.selectedFile.name);
fd.append('title', this.title);
fd.append('title2', this.title2);
fd.append('season', this.season);
fd.append('subtitle', this.subtitle);
fd.append('topSubtitle', this.topSubtitle);
fd.append('limitedSeries', this.isLimitedSeries)
if (this.selectedLogoControl.value != null){
fd.append('networkLogo', this.selectedLogoControl.value);
}
if (this.selectedStudioControl.value != null){
fd.append('logo', this.selectedStudioControl.value);
}
if (this.logoOptionControl.value != null){
fd.append('logoOption', this.logoOptionControl.value);
}
this.http.post('https://localhost:44369/poster/series', fd)
.subscribe(res => {
console.log(res);
this.retrieveResponse = res;
this.base64Data = this.retrieveResponse.picBytes;
this.retrievedImage = 'data:image/jpeg;base64,' + this.base64Data;
});
}
@HostListener('window:resize')
onResize() {
this.windowHeight = window.innerHeight - 200;
}
protected readonly LogoOptions = LogoOptions;
}
@@ -0,0 +1,3 @@
export const environment = {
production: true
};
@@ -0,0 +1,16 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>PosterMaker</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography" style="background-color: #e0d6ce">
<app-root>Loading...</app-root>
</body>
</html>
+20
View File
@@ -0,0 +1,20 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
export function getBaseUrl() {
return document.getElementsByTagName('base')[0].href;
}
const providers = [
{ provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
];
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic(providers).bootstrapModule(AppModule)
.catch(err => console.log(err));
+65
View File
@@ -0,0 +1,65 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* IE11 requires the following for NgClass support on SVG elements
*/
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
+25
View File
@@ -0,0 +1,25 @@
/* You can add global styles to this file, and also import other style files */
/* Provide sufficient contrast against white background */
a {
color: #0366d6;
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}
code {
color: #e01a76;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
html, body { height: 100%; background-color: #e0d6ce }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
header { background-color: #d5c4bd }
+13
View File
@@ -0,0 +1,13 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
@@ -0,0 +1,15 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
+30
View File
@@ -0,0 +1,30 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2022",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
@@ -0,0 +1,19 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}