Compare commits

...

8 Commits

Author SHA1 Message Date
Danyi Dávid
9bd38ddaf5 * code cleanup 2019-10-23 17:18:15 +02:00
Danyi Dávid
0d0ed38966 * angular updated from 5.2 to 8.0 2019-10-23 16:23:06 +02:00
Danyi Dávid
0e9f2a448a * Switched to HttpClient 2019-10-23 14:25:36 +02:00
Danyi Dávid
5e1b402681 * image display size fix 2018-07-09 17:10:29 +02:00
Danyi Dávid
182376f97d * mobile layout margin and padding changes 2018-07-09 11:28:27 +02:00
Danyi Dávid
313766b9cf * column count changed 2018-07-09 10:36:18 +02:00
Danyi Dávid
43f9eabaed * nofollow
* height+width added to thumb img tag
* deploy fix
2018-07-08 21:43:01 +02:00
Danyi Dávid
1b15d33841 * turned into column based design 2018-07-08 19:25:26 +02:00
49 changed files with 10819 additions and 9695 deletions

View File

@ -1,87 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "frontend"
},
"apps": [
{
"root": "src",
"outDir": "dist/browser",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"../node_modules/normalize.css/normalize.css",
"assets/css/font-awesome.css",
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"name": "ssr",
"platform": "server",
"root": "src",
"outDir": "dist/server",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main-ssr.ts",
"tsconfig": "tsconfig.app-ssr.json",
"prefix": "app",
"styles": [
"../node_modules/normalize.css/normalize.css",
"assets/css/font-awesome.css",
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}

View File

@ -4,7 +4,7 @@ root = true
[*] [*]
charset = utf-8 charset = utf-8
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true

13
.gitignore vendored
View File

@ -5,10 +5,16 @@
/dist /dist
/tmp /tmp
/out-tsc /out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies # dependencies
/node_modules /node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors # IDEs and editors
/.idea /.idea
.project .project
@ -24,6 +30,7 @@
!.vscode/tasks.json !.vscode/tasks.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
.history/*
# misc # misc
/.sass-cache /.sass-cache
@ -31,13 +38,9 @@
/coverage /coverage
/libpeerconnection.log /libpeerconnection.log
npm-debug.log npm-debug.log
yarn-error.log
testem.log testem.log
/typings /typings
yarn-error.log
# e2e
/e2e/*.js
/e2e/*.map
# System Files # System Files
.DS_Store .DS_Store

View File

@ -1,6 +1,6 @@
# Frontend # Manupgrade
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.3.0-rc.5. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.13.
## Development server ## Development server
@ -12,7 +12,7 @@ Run `ng generate component component-name` to generate a new component. You can
## Build ## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests ## Running unit tests
@ -21,7 +21,6 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
## Running end-to-end tests ## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.
## Further help ## Further help

149
angular.json Normal file
View File

@ -0,0 +1,149 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"gallery-frontend": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/normalize.css/normalize.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "gallery-frontend:build"
},
"configurations": {
"production": {
"browserTarget": "gallery-frontend:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "gallery-frontend: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/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "gallery-frontend:serve"
},
"configurations": {
"production": {
"devServerTarget": "gallery-frontend:serve:production"
}
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"sourceMap": false,
"optimization": {
"scripts": false,
"styles": true
}
}
}
}
}
}},
"defaultProject": "gallery-frontend"
}

12
browserslist Normal file
View File

@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@ -27,19 +27,20 @@ host('alfheim.ragnarok.yvan.hu')
desc('Prepare release'); desc('Prepare release');
task('deploy:ng-prepare', function() { task('deploy:ng-prepare', function() {
runLocally("npm run build:ssr"); runLocally("npm run build:ssr");
runLocally("tar -cJf dist.tar.xz dist server.js package.json pm2.json"); runLocally("tar -cJf dist.tar.xz dist package.json pm2.json");
}); });
desc('Upload release'); desc('Upload release');
task('deploy:ng-upload', function() { task('deploy:ng-upload', function() {
upload("dist.tar.xz", "{{release_path}}/dist.tar.xz"); upload("dist.tar.xz", "{{release_path}}/dist.tar.xz");
run("tar -C {{release_path}} -xJf {{release_path}}/dist.tar.xz"); run("tar -C {{release_path}} -xJf {{release_path}}/dist.tar.xz");
upload("robots.txt", "{{release_path}}/dist/browser/robots.txt");
within("{{release_path}}", function () { within("{{release_path}}", function () {
run("npm install --production"); run("npm install --production");
run("npm install express --production"); run("npm install express --production");
}); });
run("rm -f {{release_path}}/dist.tar.xz"); run("rm -f {{release_path}}/dist.tar.xz");
runLocally("rm -rf dist.tar.xz dist dist-ssr"); runLocally("rm -rf dist.tar.xz dist");
}); });
desc('Start app server'); desc('Start app server');
@ -47,7 +48,6 @@ task('deploy:pm2-restart', function() {
within("{{release_path}}", function () { within("{{release_path}}", function () {
run("pm2 stop --silent gallery-frontend"); run("pm2 stop --silent gallery-frontend");
run("pm2 delete --silent gallery-frontend"); run("pm2 delete --silent gallery-frontend");
run("pm2 start pm2.json"); run("pm2 start pm2.json");
}); });
}); });

View File

@ -4,30 +4,29 @@
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: '', basePath: '',
frameworks: ['jasmine', '@angular/cli'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [ plugins: [
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'), require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma') require('@angular-devkit/build-angular/plugins/karma')
], ],
client:{ client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser clearContext: false // leave Jasmine Spec Runner output visible in browser
}, },
coverageIstanbulReporter: { coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ], dir: require('path').join(__dirname, './coverage/manupgrade'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true fixWebpackSourcePaths: true
}, },
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: true, autoWatch: true,
browsers: ['Chrome'], browsers: ['Chrome'],
singleRun: false singleRun: false,
restartOnFileChange: true
}); });
}; };

19217
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
{ {
"name": "frontend", "name": "frontend",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
@ -9,50 +8,52 @@
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e",
"build:ssr": "npm run build:client-and-server-bundles", "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
"serve:ssr": "node dist/server.js", "serve:ssr": "node dist/server",
"build:client-and-server-bundles": "ng build --prod && ng build --prod --app ssr --output-hashing=false" "build:client-and-server-bundles": "ng build --prod && ng run gallery-frontend:server:production --bundleDependencies all",
"compile:server": "webpack --config webpack.server.config.js --progress --colors"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^5.2.0", "@angular/animations": "~8.2.11",
"@angular/common": "^5.2.0", "@angular/common": "~8.2.11",
"@angular/compiler": "^5.2.0", "@angular/compiler": "~8.2.11",
"@angular/core": "^5.2.0", "@angular/core": "~8.2.11",
"@angular/forms": "^5.2.0", "@angular/forms": "~8.2.11",
"@angular/http": "^5.2.0", "@angular/platform-browser": "~8.2.11",
"@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "~8.2.11",
"@angular/platform-browser-dynamic": "^5.2.0", "@angular/platform-server": "~8.2.11",
"@angular/platform-server": "^5.2.0", "@angular/router": "~8.2.11",
"@angular/router": "^5.2.0", "@nguniversal/express-engine": "~8.1.1",
"@nguniversal/express-engine": "^5.0.0-beta.5", "@nguniversal/module-map-ngfactory-loader": "~8.1.1",
"@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5", "express": "^4.15.2",
"core-js": "^2.4.1", "normalize.css": "^8.0.1",
"normalize.css": "^7.0.0", "pm2": "~4.1.2",
"pm2": "^2.6.1", "rxjs": "~6.4.0",
"reflect-metadata": "^0.1.12", "tslib": "^1.10.0",
"rxjs": "^5.5.6", "zone.js": "~0.9.1"
"zone.js": "^0.8.19"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "^1.7.1", "@angular-devkit/build-angular": "~0.803.13",
"@angular/compiler-cli": "^5.2.0", "@angular/cli": "~8.3.13",
"@angular/language-service": "^5.2.0", "@angular/compiler-cli": "~8.2.11",
"@types/jasmine": "~2.8.3", "@angular/language-service": "~8.2.11",
"@types/jasminewd2": "~2.0.2", "@types/node": "~8.9.4",
"@types/node": "~6.0.60", "@types/jasmine": "~3.3.8",
"codelyzer": "~4.0.1", "@types/jasminewd2": "~2.0.3",
"jasmine-core": "~2.8.0", "codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0", "karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0", "karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "~2.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~2.0.1",
"karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^1.4.0",
"karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0",
"protractor": "~5.1.2", "ts-loader": "^5.2.0",
"ts-node": "~4.1.0", "ts-node": "~7.0.0",
"tslint": "~5.9.1", "tslint": "~5.15.0",
"typescript": "~2.5.3" "typescript": "~3.5.3",
"webpack-cli": "^3.1.0"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"apps" : [{ "apps" : [{
"name" : "gallery-frontend", "name" : "gallery-frontend",
"script" : "./server.js", "script" : "dist/server.js",
"watch" : true, "watch" : true,
"env": { "env": {
"NODE_ENV": "development" "NODE_ENV": "development"

2
robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /export-album/

View File

@ -1,43 +0,0 @@
"use strict";
require("zone.js/dist/zone-node");
require("reflect-metadata");
const { enableProdMode } = require('@angular/core');
const express = require('express');
const { join } = require('path');
enableProdMode();
// Express server
const app = express();
const PORT = process.env.PORT || 4000;
const DIST_FOLDER = join(process.cwd(), 'dist');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');
// Express Engine
const { ngExpressEngine } = require("@nguniversal/express-engine");
// Import module map for lazy loading
const { provideModuleMap } = require("@nguniversal/module-map-ngfactory-loader");
app.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
provideModuleMap(LAZY_MODULE_MAP)
]
}));
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
// All regular routes use the Universal engine
app.get('*', function (req, res) {
res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req: req });
});
// Start up the Node server
app.listen(PORT, function () {
console.log("Node server listening on http://localhost:" + PORT);
});

58
server.ts Normal file
View File

@ -0,0 +1,58 @@
/**
* *** NOTE ON IMPORTING FROM ANGULAR AND NGUNIVERSAL IN THIS FILE ***
*
* If your application uses third-party dependencies, you'll need to
* either use Webpack or the Angular CLI's `bundleDependencies` feature
* in order to adequately package them for use on the server without a
* node_modules directory.
*
* However, due to the nature of the CLI's `bundleDependencies`, importing
* Angular in this file will create a different instance of Angular than
* the version in the compiled application code. This leads to unavoidable
* conflicts. Therefore, please do not explicitly import from @angular or
* @nguniversal in this file. You can export any needed resources
* from your application's main.server.ts file, as seen below with the
* import for `ngExpressEngine`.
*/
import 'zone.js/dist/zone-node';
import * as express from 'express';
import {join} from 'path';
// Express server
const app = express();
const PORT = process.env.PORT || 4000;
const DIST_FOLDER = join(process.cwd(), 'dist/browser');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {AppServerModuleNgFactory, LAZY_MODULE_MAP, ngExpressEngine, provideModuleMap} = require('./dist/server/main');
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
app.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
provideModuleMap(LAZY_MODULE_MAP)
]
}));
app.set('view engine', 'html');
app.set('views', DIST_FOLDER);
// Example Express Rest API endpoints
// app.get('/api/**', (req, res) => { });
// Serve static files from /browser
app.get('*.*', express.static(DIST_FOLDER, {
maxAge: '1y'
}));
// All regular routes use the Universal engine
app.get('*', (req, res) => {
res.render('index', { req });
});
// Start up the Node server
app.listen(PORT, () => {
console.log(`Node Express server listening on http://localhost:${PORT}`);
});

View File

@ -1,14 +1,14 @@
import {trigger, state, animate, transition, style} from '@angular/animations'; import { trigger, state, animate, transition, style } from '@angular/animations';
export const fadeInAnimation = export const fadeInAnimation =
trigger('fadeInAnimation', [ trigger('fadeInAnimation', [
// route 'enter' transition // route 'enter' transition
transition(':enter', [ transition(':enter', [
// styles at start of transition // styles at start of transition
style({opacity: 0}), style({opacity: 0}),
// animation and styles at end of transition // animation and styles at end of transition
animate('3s', style({opacity: 1})) animate('3s', style({opacity: 1}))
]), ]),
]); ]);

View File

@ -1,51 +1,51 @@
import {trigger, state, animate, transition, style} from '@angular/animations'; import { trigger, state, animate, transition, style } from '@angular/animations';
export const slideInOutAnimation = export const slideInOutAnimation =
trigger('slideInOutAnimation', [ trigger('slideInOutAnimation', [
// end state styles for route container (host) // end state styles for route container (host)
state('*', style({ state('*', style({
// the view covers the whole screen with a semi tranparent background // the view covers the whole screen with a semi tranparent background
position: 'fixed', position: 'fixed',
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,
// backgroundColor: 'rgba(0, 0, 0, 0.8)' // backgroundColor: 'rgba(0, 0, 0, 0.8)'
})), })),
// route 'enter' transition // route 'enter' transition
transition(':enter', [ transition(':enter', [
// styles at start of transition // styles at start of transition
style({ style({
// start with the content positioned off the right of the screen, // start with the content positioned off the right of the screen,
// -400% is required instead of -100% because the negative position adds to the width of the element // -400% is required instead of -100% because the negative position adds to the width of the element
top: '-100%', top: '-100%',
// start with background opacity set to 0 (invisible) // start with background opacity set to 0 (invisible)
// backgroundColor: 'rgba(0, 0, 0, 0)' // backgroundColor: 'rgba(0, 0, 0, 0)'
}), }),
// animation and styles at end of transition // animation and styles at end of transition
animate('.5s ease-in-out', style({ animate('.5s ease-in-out', style({
// transition the right position to 0 which slides the content into view // transition the right position to 0 which slides the content into view
top: 0, top: 0,
// transition the background opacity to 0.8 to fade it in // transition the background opacity to 0.8 to fade it in
// backgroundColor: 'rgba(0, 0, 0, 0.8)' // backgroundColor: 'rgba(0, 0, 0, 0.8)'
})) }))
]), ]),
// route 'leave' transition // route 'leave' transition
transition(':leave', [ transition(':leave', [
// animation and styles at end of transition // animation and styles at end of transition
animate('.5s ease-in-out', style({ animate('.5s ease-in-out', style({
// transition the right position to -400% which slides the content out of view // transition the right position to -400% which slides the content out of view
top: '-100%', top: '-100%',
// transition the background opacity to 0 to fade it out // transition the background opacity to 0 to fade it out
// backgroundColor: 'rgba(0, 0, 0, 0)' // backgroundColor: 'rgba(0, 0, 0, 0)'
})) }))
]) ])
]); ]);

View File

@ -1,9 +1,9 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server'; import { ServerModule } from '@angular/platform-server';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
@NgModule({ @NgModule({
imports: [ imports: [
@ -11,8 +11,7 @@ import { AppComponent } from './app.component';
ServerModule, ServerModule,
ModuleMapLoaderModule, ModuleMapLoaderModule,
], ],
bootstrap: [ bootstrap: [AppComponent],
AppComponent,
]
}) })
export class AppServerModule {} export class AppServerModule {
}

View File

@ -1,23 +1,48 @@
.main.container { .main.container {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
padding-left: 10px; margin-bottom: 80px;
} }
.row { .row {
display: block; line-height: 0;
float: left; column-gap: 20px;
width: 510px;
} }
.align.right { a {
float: right; cursor: pointer;
color: #2AA198;
text-decoration: none;
transition-property: color;
transition-duration: 0.5s;
transition-timing-function: ease-out;
} }
.align.left { a:hover {
float: left; color: #2a70a1;
text-decoration: none;
} }
h1 { /* mobile */
padding-right: 15px; @media only screen and (max-width: 779px) {
.row {
column-count: 1;
}
.main.container {
margin-bottom: 0;
}
}
/* tablet */
@media only screen and (min-width: 780px) and (max-width: 1219px) {
.row {
column-count: 3;
}
}
/* desktop */
@media screen and (min-width: 1220px) {
.row {
column-count: 5;
}
} }

View File

@ -1,25 +1,16 @@
<div class="main container"> <div class="main container">
<h1>{{album.name}}<span class="align right"> <h1>
<a [href]="exportUrl" title="Download compressed album"><i class="fa fa-download"></i></a>
<a [routerLink]="['']" title="Back to albums list"><i class="fa fa-level-up"></i></a> <a [routerLink]="['']" title="Back to albums list"><i class="fa fa-level-up"></i></a>
</span></h1> {{album?.name}}
<a rel="nofollow" [href]="exportUrl" title="Download compressed album"><i class="fa fa-download"></i></a>
</h1>
<div class="row images"> <div class="row images">
<app-thumbnail *ngFor="let thumbnail of thumbnailsLeft" <a app-thumbnail *ngFor="let thumbnail of thumbnails" href="#"
[image]="thumbnail.image" [image]="thumbnail.image"
[label]="thumbnail.label" [label]="thumbnail.label"
(click)="imageClick(album.slug, thumbnail.path)"></app-thumbnail> [width]="thumbnail.width"
</div> [height]="thumbnail.height"
<div class="row images"> (click)="imageClick(album.slug, thumbnail.path)"></a>
<app-thumbnail *ngFor="let thumbnail of thumbnailsMiddle"
[image]="thumbnail.image"
[label]="thumbnail.label"
(click)="imageClick(album.slug, thumbnail.path)"></app-thumbnail>
</div>
<div class="row images">
<app-thumbnail *ngFor="let thumbnail of thumbnailsRight"
[image]="thumbnail.image"
[label]="thumbnail.label"
(click)="imageClick(album.slug, thumbnail.path)"></app-thumbnail>
</div> </div>
</div> </div>
<app-display-image (imageChange)="switchImage($event)"></app-display-image> <app-display-image (imageChange)="switchImage($event)"></app-display-image>

View File

@ -7,11 +7,6 @@ import { Album, Image } from "../shared";
import { DisplayImageService } from "../display-image/display-image.service"; import { DisplayImageService } from "../display-image/display-image.service";
import { Thumbnail } from "../shared/thumbnail.model"; import { Thumbnail } from "../shared/thumbnail.model";
const IDX_LEFT = 0;
const IDX_MIDDLE = 1;
const IDX_RIGHT = 2;
const THUMB_MARGIN = 10;
@Component({ @Component({
selector: 'app-album', selector: 'app-album',
templateUrl: './album.component.html', templateUrl: './album.component.html',
@ -20,14 +15,7 @@ const THUMB_MARGIN = 10;
export class AlbumComponent implements OnInit { export class AlbumComponent implements OnInit {
public album: Album = new Album(); public album: Album = new Album();
public thumbnails: Array<Thumbnail> = [];
private leftHeight: number = 0;
private middleHeight: number = 0;
private rightHeight: number = 0;
public thumbnailsLeft: Array<Thumbnail> = [];
public thumbnailsMiddle: Array<Thumbnail> = [];
public thumbnailsRight: Array<Thumbnail> = [];
constructor(private titleService: Title, constructor(private titleService: Title,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -44,6 +32,14 @@ export class AlbumComponent implements OnInit {
property: 'og:image', property: 'og:image',
content: this.imageUrl(this.album.coverImage) content: this.imageUrl(this.album.coverImage)
}); });
this.metaService.updateTag({
property: 'og:title',
content: this.album.name
});
this.metaService.updateTag({
property: 'og:description',
content: this.album.date
});
this.route.params.subscribe((params: { this.route.params.subscribe((params: {
slug: string, slug: string,
image: string image: string
@ -69,24 +65,8 @@ export class AlbumComponent implements OnInit {
extraLeft: '', extraLeft: '',
}, },
height: image.thumbHeight, height: image.thumbHeight,
}).map(thumbnail => { width: image.thumbWidth
let heights = [this.leftHeight, this.middleHeight, this.rightHeight]; }).map(thumbnail => this.thumbnails.push(thumbnail));
let idx = heights.reduce((low, nxt, idx) => nxt < heights[low] ? idx : low, 0);
switch (idx) {
case IDX_LEFT:
this.thumbnailsLeft.push(thumbnail);
this.leftHeight += thumbnail.height + THUMB_MARGIN;
break;
case IDX_MIDDLE:
this.thumbnailsMiddle.push(thumbnail);
this.middleHeight += thumbnail.height + THUMB_MARGIN;
break;
case IDX_RIGHT:
this.thumbnailsRight.push(thumbnail);
this.rightHeight += thumbnail.height + THUMB_MARGIN;
break;
}
});
} }
public get exportUrl(): string { public get exportUrl(): string {
@ -99,6 +79,7 @@ export class AlbumComponent implements OnInit {
public imageClick(slug: string, path: string) { public imageClick(slug: string, path: string) {
this.displayImageService.activate(slug, path, this.album.name); this.displayImageService.activate(slug, path, this.album.name);
return false;
} }
public switchImage(evnt: { direction: string, currentPath: string }) { public switchImage(evnt: { direction: string, currentPath: string }) {

View File

@ -10,22 +10,19 @@
-webkit-transition: opacity 150ms ease-in; -webkit-transition: opacity 150ms ease-in;
-moz-transition: opacity 150ms ease-in; -moz-transition: opacity 150ms ease-in;
transition: opacity 150ms ease-in; transition: opacity 150ms ease-in;
height: 100%;
width: 100%;
padding: 15px; padding: 15px;
overflow: hidden; overflow: hidden;
} }
.modal-padding { .modal-padding {
overflow: hidden; height: 100%;
max-height: calc(100% - 30px); width: 100%;
max-width: calc(100% - 30px);
} }
.modal-container .image { .modal-container .image {
display: block; display: block;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
max-height: calc(100% - 30px); max-height: 100%;
width: auto; max-width: 100%;
} }

View File

@ -1,5 +1,4 @@
import { Component, EventEmitter, HostListener, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
import { Location } from "@angular/common";
import { environment } from "../../../environments/environment"; import { environment } from "../../../environments/environment";
import { Title } from "@angular/platform-browser"; import { Title } from "@angular/platform-browser";
@ -45,8 +44,7 @@ export class DisplayImageComponent implements OnInit {
} }
public get imageUrl(): string { public get imageUrl(): string {
let url = environment.apiUrl + `/image/${this.slug}/${this.image}`; return environment.apiUrl + `/image/${this.slug}/${this.image}`;
return url;
} }
public activate(slug = "", image = "", extitle = "") { public activate(slug = "", image = "", extitle = "") {
@ -93,7 +91,7 @@ export class DisplayImageComponent implements OnInit {
} }
@HostListener('document:keyup', ['$event.key']) @HostListener('document:keyup', ['$event.key'])
private handleKeyPress(keyPressed: string) { public handleKeyPress(keyPressed: string) {
if (this.visible) { if (this.visible) {
switch (keyPressed) { switch (keyPressed) {
case 'Escape': case 'Escape':
@ -112,20 +110,20 @@ export class DisplayImageComponent implements OnInit {
} }
@HostListener('click') @HostListener('click')
private handleClick() { public handleClick() {
if (this.visible) { if (this.visible) {
this.nextImage(); this.nextImage();
} }
} }
@HostListener('touchstart', ['$event']) @HostListener('touchstart', ['$event'])
private touchStart(touchEvent: TouchEvent) { public touchStart(touchEvent: TouchEvent) {
this.touchX = touchEvent.touches[0].clientX; this.touchX = touchEvent.touches[0].clientX;
this.touchY = touchEvent.touches[0].clientY; this.touchY = touchEvent.touches[0].clientY;
} }
@HostListener('touchend', ['$event']) @HostListener('touchend', ['$event'])
private touchEnd(touchEvent: TouchEvent) { public touchEnd(touchEvent: TouchEvent) {
let xDiff: number = this.touchX - touchEvent.changedTouches[0].clientX; let xDiff: number = this.touchX - touchEvent.changedTouches[0].clientX;
let yDiff: number = this.touchY - touchEvent.changedTouches[0].clientY; let yDiff: number = this.touchY - touchEvent.changedTouches[0].clientY;
@ -145,7 +143,7 @@ export class DisplayImageComponent implements OnInit {
} }
@HostListener('touchcancel') @HostListener('touchcancel')
private touchCancel() { public touchCancel() {
this.touchX = 0; this.touchX = 0;
this.touchY = 0; this.touchY = 0;
} }

View File

@ -2,8 +2,5 @@ import { Injectable } from '@angular/core';
@Injectable() @Injectable()
export class DisplayImageService { export class DisplayImageService {
activate: (message?: string, title?: string, extitle?: string) => Promise<boolean>;
constructor() { }
activate: (message?: string, title?: string, extitle? :string) => Promise<boolean>;
} }

View File

@ -2,51 +2,52 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { GalleryComponent } from "./gallery/gallery.component"; import { GalleryComponent } from "./gallery/gallery.component";
import { GalleryService } from "./shared/gallery.service"; import { GalleryService } from "./shared";
import { AlbumComponent } from "./album/album.component"; import { AlbumComponent } from "./album/album.component";
import { DisplayImageComponent } from "./display-image/display-image.component"; import { DisplayImageComponent } from "./display-image/display-image.component";
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
children: [], children: [],
component: GalleryComponent, component: GalleryComponent,
resolve: { resolve: {
albums: GalleryService, albums: GalleryService,
}, },
}, { }, {
path: 'galleries', path: 'galleries',
children: [], children: [],
component: GalleryComponent, component: GalleryComponent,
resolve: { resolve: {
albums: GalleryService, albums: GalleryService,
}, },
}, { }, {
path: 'album/:slug', path: 'album/:slug',
children: [], children: [],
component: AlbumComponent, component: AlbumComponent,
resolve: { resolve: {
albums: GalleryService, albums: GalleryService,
}, },
}, { }, {
path: 'album/:slug/:image', path: 'album/:slug/:image',
children: [], children: [],
component: AlbumComponent, component: AlbumComponent,
resolve: { resolve: {
albums: GalleryService, albums: GalleryService,
}, },
}, { }, {
path: 'image/:slug/:image', path: 'image/:slug/:image',
children: [], children: [],
component: DisplayImageComponent, component: DisplayImageComponent,
resolve: { resolve: {
albums: GalleryService, albums: GalleryService,
}, },
} }
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule]
}) })
export class GalleryRoutingModule { } export class GalleryRoutingModule {
}

View File

@ -1,7 +1,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { HttpModule } from "@angular/http"; import { HttpClientModule } from "@angular/common/http";
import { GalleryService } from './shared/gallery.service'; import { GalleryService } from './shared';
import { GalleryComponent } from './gallery/gallery.component'; import { GalleryComponent } from './gallery/gallery.component';
import { AlbumComponent } from './album/album.component'; import { AlbumComponent } from './album/album.component';
import { DisplayImageComponent } from './display-image/display-image.component'; import { DisplayImageComponent } from './display-image/display-image.component';
@ -10,20 +10,21 @@ import { DisplayImageService } from './display-image/display-image.service';
import { ThumbnailComponent } from './thumbnail/thumbnail.component'; import { ThumbnailComponent } from './thumbnail/thumbnail.component';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
HttpModule, HttpClientModule,
GalleryRoutingModule, GalleryRoutingModule,
], ],
exports: [ exports: [
GalleryComponent, GalleryComponent,
], ],
declarations: [ declarations: [
GalleryComponent, GalleryComponent,
AlbumComponent, AlbumComponent,
DisplayImageComponent, DisplayImageComponent,
ThumbnailComponent, ThumbnailComponent,
], ],
providers: [ GalleryService, DisplayImageService ] providers: [GalleryService, DisplayImageService]
}) })
export class GalleryModule { } export class GalleryModule {
}

View File

@ -1,11 +1,34 @@
.main.container { .main.container {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
padding-left: 10px; margin-bottom: 80px;
} }
.row { .row {
display: block; line-height: 0;
float: left; column-gap: 20px;
width: 510px; }
/* mobile */
@media only screen and (max-width: 779px) {
.row {
column-count: 1;
}
.main.container {
margin-bottom: 0;
}
}
/* tablet */
@media only screen and (min-width: 780px) and (max-width: 1219px) {
.row {
column-count: 3;
}
}
/* desktop */
@media screen and (min-width: 1220px) {
.row {
column-count: 5;
}
} }

View File

@ -1,21 +1,11 @@
<div class="main container"> <div class="main container">
<h1>Albums</h1> <h1>Albums</h1>
<div class="row images"> <div class="row images">
<a app-thumbnail *ngFor="let thumbnail of thumbnailsLeft" <a app-thumbnail *ngFor="let thumbnail of thumbnails"
[image]="thumbnail.image"
[label]="thumbnail.label"
[routerLink]="['/album', thumbnail.slug]"></a>
</div>
<div class="row images">
<a app-thumbnail *ngFor="let thumbnail of thumbnailsMiddle"
[image]="thumbnail.image"
[label]="thumbnail.label"
[routerLink]="['/album', thumbnail.slug]"></a>
</div>
<div class="row images">
<a app-thumbnail *ngFor="let thumbnail of thumbnailsRight"
[image]="thumbnail.image" [image]="thumbnail.image"
[label]="thumbnail.label" [label]="thumbnail.label"
[width]="thumbnail.width"
[height]="thumbnail.height"
[routerLink]="['/album', thumbnail.slug]"></a> [routerLink]="['/album', thumbnail.slug]"></a>
</div> </div>
</div> </div>

View File

@ -6,11 +6,6 @@ import { Album } from "../shared";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { Thumbnail } from "../shared/thumbnail.model"; import { Thumbnail } from "../shared/thumbnail.model";
const IDX_LEFT = 0;
const IDX_MIDDLE = 1;
const IDX_RIGHT = 2;
const THUMB_MARGIN = 10;
@Component({ @Component({
selector: 'app-gallery', selector: 'app-gallery',
templateUrl: './gallery.component.html', templateUrl: './gallery.component.html',
@ -19,14 +14,7 @@ const THUMB_MARGIN = 10;
export class GalleryComponent implements OnInit { export class GalleryComponent implements OnInit {
public albums: Array<Album> = []; public albums: Array<Album> = [];
public thumbnails: Array<Thumbnail> = [];
private leftHeight: number = 0;
private middleHeight: number = 0;
private rightHeight: number = 0;
public thumbnailsLeft: Array<Thumbnail> = [];
public thumbnailsMiddle: Array<Thumbnail> = [];
public thumbnailsRight: Array<Thumbnail> = [];
constructor(private titleService: Title, constructor(private titleService: Title,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -42,6 +30,14 @@ export class GalleryComponent implements OnInit {
property: 'og:image', property: 'og:image',
content: this.imageUrl(this.albums[0]) content: this.imageUrl(this.albums[0])
}); });
this.metaService.updateTag({
property: 'og:title',
content: "photos.yvan.hu"
});
this.metaService.updateTag({
property: 'og:description',
content: "My public photo gallery"
});
}); });
} }
@ -55,24 +51,8 @@ export class GalleryComponent implements OnInit {
extraLeft: album.date, extraLeft: album.date,
}, },
height: album.coverImage.thumbHeight, height: album.coverImage.thumbHeight,
}).map(thumbnail => { width: album.coverImage.thumbWidth
let heights = [this.leftHeight, this.middleHeight, this.rightHeight]; }).map(thumbnail => this.thumbnails.push(thumbnail));
let idx = heights.reduce((low, nxt, idx) => nxt < heights[low] ? idx : low, 0);
switch (idx) {
case IDX_LEFT:
this.thumbnailsLeft.push(thumbnail);
this.leftHeight += thumbnail.height + THUMB_MARGIN;
break;
case IDX_MIDDLE:
this.thumbnailsMiddle.push(thumbnail);
this.middleHeight += thumbnail.height + THUMB_MARGIN;
break;
case IDX_RIGHT:
this.thumbnailsRight.push(thumbnail);
this.rightHeight += thumbnail.height + THUMB_MARGIN;
break;
}
});
} }
private imageUrl(album: Album): string { private imageUrl(album: Album): string {

View File

@ -4,12 +4,12 @@ export const IMAGE_STANDARD = 0;
export const IMAGE_PANORAMA = 1; export const IMAGE_PANORAMA = 1;
export class Album { export class Album {
public slug: string = ""; public slug: string = "";
public name: string = ""; public name: string = "";
public date: string = ""; public date: string = "";
public coverImage: Image; public coverImage: Image;
public type: number = IMAGE_STANDARD; public type: number = IMAGE_STANDARD;
public isNew: boolean = false; public isNew: boolean = false;
public isPublic: boolean = true; public isPublic: boolean = true;
public images: Array<Image> = []; public images: Array<Image> = [];
} }

View File

@ -1,40 +1,39 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http } from "@angular/http"; import { HttpClient } from "@angular/common/http";
import { ActivatedRouteSnapshot, Resolve } from "@angular/router"; import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
import { Observable } from "rxjs/Observable"; import { Observable } from "rxjs";
import 'rxjs/Rx';
import { environment } from "../../../environments/environment"; import { environment } from "../../../environments/environment";
import { Album, Image } from "."; import { Album } from "./album.model";
@Injectable() @Injectable()
export class GalleryService implements Resolve<Array<Album>|false> { export class GalleryService implements Resolve<Array<Album> | false> {
public albums: Array<Album> = []; public albums: Array<Album> = [];
constructor( constructor(
private httpService: Http, private httpService: HttpClient,
) {} ) {}
public listGalleries(): Observable<Array<Album>> { public listGalleries(): Observable<Array<Album>> {
return this.httpService.get(environment.apiUrl + '/api/galleries').map(res => res.json()); return this.httpService.get<Array<Album>>(environment.apiUrl + '/api/galleries');
} }
/** /**
* @param {ActivatedRouteSnapshot} route * @param {ActivatedRouteSnapshot} route
* @returns {Promise<Array<Album>>} * @returns {Promise<Array<Album>>}
* @todo add some cache ttl to albums? * @todo add some cache ttl to albums?
*/ */
public resolve(route: ActivatedRouteSnapshot): Promise<Array<Album>|false> { public resolve(route: ActivatedRouteSnapshot): Promise<Array<Album> | false> {
if(this.albums.length) { if (this.albums.length) {
return Promise.resolve(this.albums); return Promise.resolve(this.albums);
}
return this.listGalleries().toPromise().then(result => {
if (result) {
this.albums = result;
return result;
}
return false;
});
} }
return this.listGalleries().toPromise().then(result => {
if(result) {
this.albums = result;
return result;
}
return false;
});
}
} }

View File

@ -1,9 +1,9 @@
export class Image { export class Image {
public dir: string = ""; public dir: string = "";
public label: string = ""; public label: string = "";
public path: string = ""; public path: string = "";
public width: number = 0; public width: number = 0;
public height: number = 0; public height: number = 0;
public thumbWidth: number = 0; public thumbWidth: number = 0;
public thumbHeight: number = 0; public thumbHeight: number = 0;
} }

View File

@ -1,5 +1,5 @@
export class ThumbLabel { export class ThumbLabel {
public title: string = ""; public title: string = "";
public extraLeft: string = ""; public extraLeft: string = "";
public extraRight: string = ""; public extraRight: string = "";
} }

View File

@ -1,9 +1,10 @@
import {ThumbLabel} from "./thumb-label.model"; import { ThumbLabel } from "./thumb-label.model";
export class Thumbnail { export class Thumbnail {
public slug: string = ''; public slug: string = '';
public image: string = ''; public image: string = '';
public path: string = ''; public path: string = '';
public label: ThumbLabel = new ThumbLabel(); public label: ThumbLabel = new ThumbLabel();
public height: number = 0; public height: number = 0;
public width: number = 0;
} }

View File

@ -1,12 +1,24 @@
:host { :host {
display: flex; display: block;
margin: 0 0 20px 0;
}
/* mobile */
@media only screen and (max-width: 779px) {
:host {
margin-bottom: 10px;
}
}
img {
width: 100%;
height: auto;
} }
.thumbnail { .thumbnail {
position: relative; position: relative;
display: inline-block; display: block;
margin-right: 10px; overflow: hidden;
margin-bottom: 10px;
} }
.thumbnail img.image { .thumbnail img.image {
@ -21,15 +33,32 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
line-height: 1rem;
transform-origin: 50% 100%; transform-origin: 50% 100%;
transition-property: transform; transition-property: transform;
transition-duration: 0.15s; transition-duration: 0.15s;
transition-timing-function: ease-out; transition-timing-function: ease-out;
transform: scaleY(0); transform: translateY(100%);
}
a:link,
a:visited,
a:hover,
a:active
{
color: #ffffff;
}
.thumbnail > div.label > h1 {
font-size: 150%;
}
.thumbnail > div.label > h2 {
font-size: 120%;
} }
.thumbnail:hover > div.label { .thumbnail:hover > div.label {
transform: scaleY(1); transform: translateY(0);
} }
.align.right { .align.right {

View File

@ -1,5 +1,5 @@
<a class="thumbnail"> <a class="thumbnail">
<img class="image" src="{{image}}"> <img class="image" src="{{image}}" [width]="width" [height]="height">
<div class="label" *ngIf="label"> <div class="label" *ngIf="label">
<h1 class="title">{{label.title}}</h1> <h1 class="title">{{label.title}}</h1>
<h2 class="extra">{{label.extraLeft}}<span class="align right">{{label.extraRight}}</span></h2> <h2 class="extra">{{label.extraLeft}}<span class="align right">{{label.extraRight}}</span></h2>

View File

@ -1,20 +1,16 @@
import {Component, Input, OnInit} from '@angular/core'; import { Component, Input } from '@angular/core';
import {ThumbLabel} from "../shared/thumb-label.model"; import { ThumbLabel } from "../shared/thumb-label.model";
@Component({ @Component({
selector: 'app-thumbnail, [app-thumbnail]', selector: 'app-thumbnail, [app-thumbnail]',
templateUrl: './thumbnail.component.html', templateUrl: './thumbnail.component.html',
styleUrls: ['./thumbnail.component.css'] styleUrls: ['./thumbnail.component.css']
}) })
export class ThumbnailComponent implements OnInit { export class ThumbnailComponent {
@Input() image: string = "";
@Input() image: string = ""; @Input() label: ThumbLabel = null;
@Input() label: ThumbLabel = null; @Input() target: any = {};
@Input() target: any = {}; @Input() width: number = 0;
@Input() height: number = 0;
constructor() {}
ngOnInit() {}
} }

View File

@ -1,4 +1,4 @@
export const environment = { export const environment = {
production: true, production: true,
apiUrl: 'http://photos-api.yvan.hu', apiUrl: 'https://photos-api.yvan.hu',
}; };

View File

@ -6,5 +6,5 @@
export const environment = { export const environment = {
production: false, production: false,
// apiUrl: 'http://localhost:8888', // apiUrl: 'http://localhost:8888',
apiUrl: 'http://photos-api.yvan.hu', apiUrl: '//photos-api.yvan.hu',
}; };

View File

@ -4,11 +4,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Gallery</title> <title>Gallery</title>
<base href="/"> <base href="/">
<meta name="og:title" content="Angullery"/>
<meta name="og:description" content="A really simple photo album"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body> <body>

12
src/main.server.ts Normal file
View File

@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
export { ngExpressEngine } from "@nguniversal/express-engine";
export { provideModuleMap } from "@nguniversal/module-map-ngfactory-loader";

View File

@ -8,4 +8,6 @@ if (environment.production) {
enableProdMode(); enableProdMode();
} }
platformBrowserDynamic().bootstrapModule(AppModule); document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule);
});

View File

@ -38,8 +38,8 @@
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; //import 'core-js/es6/reflect';
import 'core-js/es7/reflect'; //import 'core-js/es7/reflect';
/** /**

View File

@ -1,51 +1,44 @@
/* You can add global styles to this file, and also import other style files */ /* You can add global styles to this file, and also import other style files */
@import url('https://fonts.googleapis.com/css?family=Source Sans Pro:400,700,400italic,700italic&subset=latin'); @import url('https://fonts.googleapis.com/css?family=Source Sans Pro:400,700,400italic,700italic&subset=latin');
/*html,*/
/*body {*/
/*height: 100%;*/
/*}*/
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow-x: hidden; overflow-x: hidden;
min-width: 320px; min-width: 320px;
background: #002B36; background: #ffffff;
font-family: "Source Sans Pro", 'Helvetica Neue', Arial, Helvetica, sans-serif; font-family: "Source Sans Pro", 'Helvetica Neue', Arial, Helvetica, sans-serif;
font-size: 14px; font-size: 14px;
line-height: 1.4285em; line-height: 1.4285em;
color: #839496; color: rgb(30%, 30%, 30%);
user-select: none; user-select: none;
} }
a { a:link,
cursor: pointer; a:visited,
color: #2AA198; a:hover,
text-decoration: none; a:active
{
color: #ffffff;
} }
a:hover { /* mobile */
color: #2AA198; @media only screen and (max-width: 779px) {
text-decoration: none;
}
/* app style */
@media screen and (min-width: 600px) {
.main.container { .main.container {
width: 515px; width: calc(100% - 20px);
} }
} }
@media screen and (min-width: 1200px) { /* tablet */
@media only screen and (min-width: 780px) and (max-width: 1219px) {
.main.container { .main.container {
width: 1030px; width: calc(100% - 80px);
} }
} }
@media screen and (min-width: 1600px) { /* desktop */
@media screen and (min-width: 1220px) {
.main.container { .main.container {
width: 1545px; width: calc(100% - 80px);
} }
} }

View File

@ -1,16 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "commonjs",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
}
}

View File

@ -2,10 +2,15 @@
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../out-tsc/app", "outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": [] "types": []
}, },
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"**/*.ts"
],
"exclude": [ "exclude": [
"test.ts", "test.ts",
"**/*.spec.ts" "**/*.spec.ts"

13
src/tsconfig.server.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "../out-tsc/app-server",
"module": "commonjs"
},
"files": [
"main.server.ts"
],
"angularCompilerOptions": {
"entryModule": "./app/app.server.module#AppServerModule"
}
}

View File

@ -2,16 +2,14 @@
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../out-tsc/spec", "outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [ "types": [
"jasmine", "jasmine",
"node" "node"
] ]
}, },
"files": [ "files": [
"test.ts" "test.ts",
"polyfills.ts"
], ],
"include": [ "include": [
"**/*.spec.ts", "**/*.spec.ts",

View File

@ -1,19 +1,26 @@
{ {
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"moduleResolution": "node", "downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "es5", "module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [ "typeRoots": [
"node_modules/@types" "node_modules/@types"
], ],
"lib": [ "lib": [
"es2017", "es2018",
"dom" "dom"
] ]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
} }
} }

51
webpack.server.config.js Normal file
View File

@ -0,0 +1,51 @@
// Work around for https://github.com/angular/angular-cli/issues/7200
const path = require('path');
const webpack = require('webpack');
module.exports = {
mode: 'none',
entry: {
// This is our Express server for Dynamic universal
server: './server.ts'
},
externals: {
'./dist/server/main': 'require("./server/main")'
},
target: 'node',
resolve: { extensions: ['.ts', '.js'] },
optimization: {
minimize: true
},
output: {
// Puts the output at the root of the dist folder
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
noParse: /polyfills-.*\.js/,
rules: [
{ test: /\.ts$/, loader: 'ts-loader' },
{
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
// Removing this will cause deprecation warnings to appear.
test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/,
parser: { system: true },
},
]
},
plugins: [
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'), // location of your src
{} // a map of your routes
),
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
)
]
};