Apply standard/enforced code format with prettier.

This commit marks applying prettier to the whole of git history up to this point and prettier is used to enforce format via pre-commit hook. The command used was: `git filter-branch -f --tree-filter 'prettier --no-config --single-quote --tab-width=1 --print-width=100 --use-tabs --trailing-comma=none --prose-wrap=always --write "{.,{packages,bin}/**}/*.{js,json,md}" || echo "Error formatting, possibly invalid JS"' -- --all`
This commit is contained in:
Timothy Farrell 2018-07-19 07:48:57 -05:00
parent b9f33cbb64
commit f08476e7ec
4 changed files with 21 additions and 19 deletions

View File

@ -5,8 +5,8 @@ myself and to share with friends and family. Along the way it became a learning
## Features ## Features
* Upload and view images - Upload and view images
* Save files to Backblaze B2 storage. - Save files to Backblaze B2 storage.
## Development Philosophy ## Development Philosophy
@ -19,9 +19,9 @@ photo gallery for anyone who wishes to escape the social media silos. However, i
This would not be possible without the giants who have laid the foundation: This would not be possible without the giants who have laid the foundation:
* [Webpack](http://webpack.js.org/) - [Webpack](http://webpack.js.org/)
* [DOMVM](http://leeoniya.github.io/domvm/) - [DOMVM](http://leeoniya.github.io/domvm/)
* [PouchDB](https://pouchdb.com/) - [PouchDB](https://pouchdb.com/)
There are many more dependencies. You can find them in the [package.json](./package.json) file. There are many more dependencies. You can find them in the [package.json](./package.json) file.
@ -36,12 +36,12 @@ localhost certificate exception in order to operate properly.
In the future, I plan to add: In the future, I plan to add:
* sharable links - sharable links
* local file storage - local file storage
* CSRF for interacting with server component - CSRF for interacting with server component
* albums - albums
* client-side encryption - client-side encryption
* video support - video support
* Sandstorm support - Sandstorm support
* CORS-based storage: - s3 - remotestorage - Google Cloud? - Dropbox? - CORS-based storage: - s3 - remotestorage - Google Cloud? - Dropbox?
* tags - tags

View File

@ -2,7 +2,9 @@
"name": "Gallery", "name": "Gallery",
"version": "0.0.1", "version": "0.0.1",
"description": "Personal photo gallery", "description": "Personal photo gallery",
"keywords": ["javascript"], "keywords": [
"javascript"
],
"author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)", "author": "Timothy Farrell <tim@thecookiejar.me> (https://github.com/explorigin)",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -50,11 +50,11 @@ export function FocusView(vm, params) {
if (windowRatio > imageRatio) { if (windowRatio > imageRatio) {
return { return {
height: vw / windowRatio, height: vw / windowRatio,
width: vw / windowRatio * imageRatio width: (vw / windowRatio) * imageRatio
}; };
} }
return { return {
height: vh * windowRatio / imageRatio, height: (vh * windowRatio) / imageRatio,
width: vh * windowRatio width: vh * windowRatio
}; };
}, },

View File

@ -32,7 +32,7 @@ export function SectionView(vm, params, key) {
const availableWidth = vw - CONTENT_MARGIN_WIDTH; const availableWidth = vw - CONTENT_MARGIN_WIDTH;
const aspectRatios = pArr.map(aspectRatio); const aspectRatios = pArr.map(aspectRatio);
const totalImageRatio = sum(aspectRatios); const totalImageRatio = sum(aspectRatios);
const rowCount = Math.ceil(totalImageRatio * OPTIMAL_IMAGE_HEIGHT / availableWidth); const rowCount = Math.ceil((totalImageRatio * OPTIMAL_IMAGE_HEIGHT) / availableWidth);
const rowRatios = partition(aspectRatios, rowCount); const rowRatios = partition(aspectRatios, rowCount);
let index = 0; let index = 0;
@ -41,7 +41,7 @@ export function SectionView(vm, params, key) {
const rowTotal = sum(row); const rowTotal = sum(row);
const imageRatio = row[0]; const imageRatio = row[0];
const portion = imageRatio / rowTotal; const portion = imageRatio / rowTotal;
let rowHeight = availableWidth * portion / aspectRatio(pArr[index]); let rowHeight = (availableWidth * portion) / aspectRatio(pArr[index]);
if (rowHeight > OPTIMAL_IMAGE_HEIGHT * ROW_HEIGHT_CUTOFF_MODIFIER) { if (rowHeight > OPTIMAL_IMAGE_HEIGHT * ROW_HEIGHT_CUTOFF_MODIFIER) {
rowHeight = OPTIMAL_IMAGE_HEIGHT * ROW_HEIGHT_CUTOFF_MODIFIER; rowHeight = OPTIMAL_IMAGE_HEIGHT * ROW_HEIGHT_CUTOFF_MODIFIER;
} }