Skip to content

Commit

Permalink
Add prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-ismagilov committed Aug 21, 2024
1 parent d255c90 commit 13e36b4
Show file tree
Hide file tree
Showing 57 changed files with 2,332 additions and 1,955 deletions.
74 changes: 12 additions & 62 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"ignorePatterns": [
"build/**"
],
"ignorePatterns": ["build/**"],
"env": {
"node": true,
"browser": true,
Expand All @@ -10,7 +8,8 @@
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime"
"plugin:react/jsx-runtime",
"plugin:prettier/recommended"
],
"settings": {
"react": {
Expand All @@ -24,77 +23,28 @@
"ecmaVersion": 2022,
"sourceType": "module"
},
"plugins": [
"react",
"simple-import-sort"
],
"plugins": ["react", "simple-import-sort"],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"eol-last": [
"error",
"always"
],
"no-case-declarations": "off",
"object-curly-spacing": [
"error",
"always"
],
"no-unused-vars": [
"warn"
],
"react/prop-types": [
"off"
],
"react/prop-types": ["off"],
"simple-import-sort/imports": [
"error",
{
"groups": [
// Packages `react` related packages come first.
[
"^react",
"^@?\\w"
],
["^react", "^@?\\w"],
// Internal packages.
[
"^(@|components)(/.*|$)"
],
["^(@|components)(/.*|$)"],
// Side effect imports.
[
"^\\u0000"
],
["^\\u0000"],
// Parent imports. Put `..` last.
[
"^\\.\\.(?!/?$)",
"^\\.\\./?$"
],
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
[
"^\\./(?=.*/)(?!/?$)",
"^\\.(?!/?$)",
"^\\./?$"
],
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports.
[
"^.+\\.?(css)$"
]
["^.+\\.?(css)$"]
]
}
],
"simple-import-sort/exports": "error"
}
}
}
9 changes: 4 additions & 5 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish GitHub Pages
on:
push:
branches:
- 'main'
- "main"

jobs:
build:
Expand Down Expand Up @@ -41,13 +41,12 @@ jobs:
data_folder: dataACPC
folder: acpc


steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
node-version: "16"
cache: "npm"
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build
Expand Down Expand Up @@ -89,7 +88,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions: write-all
steps:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Publish release
on:
push:
branches:
- 'main'
- "main"

jobs:
build:
Expand Down Expand Up @@ -33,13 +33,13 @@ jobs:
data_folder: dataEU
- public_url: galleryACPC # acpc
data_folder: dataACPC

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
node-version: "16"
cache: "npm"
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tabWidth": 2
}
65 changes: 34 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ Created to substitute [news.icpc.global/gallery](https://news.icpc.global/galler
[Figma mockups](https://www.figma.com/file/MvNh0jm8dj0LXOh9vsVUbK/ICPC-Live?node-id=0%3A1)

Important features to keep:
* no-backend flickr-based solution
* photos are classified based on public flickr tags: year, event, team
* individuals are tagged as "Firstname Lastname (location)"
* show metadata information: photographer, year, event, team, tagged individuals, highlight tag locations
* search by substring over all tags
* easy image download
* adaptive interface for larger screens
* mobile version

- no-backend flickr-based solution
- photos are classified based on public flickr tags: year, event, team
- individuals are tagged as "Firstname Lastname (location)"
- show metadata information: photographer, year, event, team, tagged individuals, highlight tag locations
- search by substring over all tags
- easy image download
- adaptive interface for larger screens
- mobile version

# User guide

Expand Down Expand Up @@ -41,42 +42,45 @@ To search by a keyword just type it into the Search field. For example, `Bill`,
# Development

The gallery is built on top of the flickr api backend. All metadata is stored in photo exif tags. Tag types are:
* year, for example `album$2001`
* event, for example `event$Team Photos`
* team, for example `team$Aalto University`
* person, for example `Bill Poucher(1761524d3f579a4d)`. The data in parenthesis denotes face location within the image in Picasa standard.

- year, for example `album$2001`
- event, for example `event$Team Photos`
- team, for example `team$Aalto University`
- person, for example `Bill Poucher(1761524d3f579a4d)`. The data in parenthesis denotes face location within the image in Picasa standard.

Visit [tutorial](https://docs.google.com/document/d/1yBeLEYyGG2FpZGjBmAHP37gJAnKGtA56hAf1XjW8d18/edit#heading=h.iv1qq69p60ub) for more info.

## Picasa Standard Face Tag
The 16 characters enclosed in rect64(…) is a 64-bit hexadecimal number which can be broken up into four 16-bit numbers used to identify the position of the rectangle used to mark the face.

If you divide each of the four 16-bit numbers by the maximum unsigned 16-bit number (65535), you’ll get four numbers between 0 and 1 which give the relative coordinates for the face rectangle in the order: left, top, right, bottom.
The 16 characters enclosed in rect64(…) is a 64-bit hexadecimal number which can be broken up into four 16-bit numbers used to identify the position of the rectangle used to mark the face.

If you divide each of the four 16-bit numbers by the maximum unsigned 16-bit number (65535), you’ll get four numbers between 0 and 1 which give the relative coordinates for the face rectangle in the order: left, top, right, bottom.

To calculate the absolute coordinates, multiply the left and right relative coordinates by the width of the image and multiply the top and bottom relative coordinates by the height of the image. This way the faces will always be identified even when the image is re-sized.
To calculate the absolute coordinates, multiply the left and right relative coordinates by the width of the image and multiply the top and bottom relative coordinates by the height of the image. This way the faces will always be identified even when the image is re-sized.

## Flickr Tag Processing

Even though flickr stores tags in their initial form, it is important to remember the following
* by default, manually entered tags are split into separate words. Enclose the tag in quotes `"team$Aalto University"` to keep tag intact
* flickr eliminates all spaces and non-letter sybmols from tags for the filtering purposes
* make sure to keep correct encoding on tags, specifically in people names, to consistently process diacritic symbols
* make sure to enclose all university names with punctuation in quotes

- by default, manually entered tags are split into separate words. Enclose the tag in quotes `"team$Aalto University"` to keep tag intact
- flickr eliminates all spaces and non-letter sybmols from tags for the filtering purposes
- make sure to keep correct encoding on tags, specifically in people names, to consistently process diacritic symbols
- make sure to enclose all university names with punctuation in quotes

## Configuration

[`src/const.js`](https://github.com/icpc/gallery/blob/main/data/consts.js) contais access detail and general year setup.
[`src/const.js`](https://github.com/icpc/gallery/blob/main/data/consts.js) contais access detail and general year setup.

This repository supports multiple galleries, each with its own dedicated [`/data/`](https://github.com/icpc/gallery/tree/main/data) folder.
Each year is represented by three files in this folder: ```.event```, ```.people``` and ```.team``` with one item per line.
Each year is represented by three files in this folder: `.event`, `.people` and `.team` with one item per line.

## Production Deployment Guide

1. After every commit Action [Publish Release](https://github.com/icpc/gallery/actions) will run automatically.
1. Open the Action page for the corresponding run. Wait for it to finish
1. Download the created ```all_raw``` on the bottom of the page
1. Upload the acquired ```all_raw.zip``` archive into Bluehost -> Advanced -> File Manager -> under ```home/public_html/newsicpc/``` folder
1. Select ```all_raw.zip``` in the bluehost filemanager webinterface and press the ```Extract``` button
1. Download the created `all_raw` on the bottom of the page
1. Upload the acquired `all_raw.zip` archive into Bluehost -> Advanced -> File Manager -> under `home/public_html/newsicpc/` folder
1. Select `all_raw.zip` in the bluehost filemanager webinterface and press the `Extract` button
1. All new galleries are deployed, good job!

## Development Deployment Guide
Expand All @@ -102,10 +106,9 @@ npm run build -- --base=/%PUBLIC_URL%

## Future Work:

* easy interface to suggest a photo tag change
* (?) support universities changing names
* rename events for better consistence (correct flickr tags)
* release badge recognition tool
* release tag embedding tool
* support a face recognition tool

- easy interface to suggest a photo tag change
- (?) support universities changing names
- rename events for better consistence (correct flickr tags)
- release badge recognition tool
- release tag embedding tool
- support a face recognition tool
50 changes: 25 additions & 25 deletions data/consts.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
export const places = [
["2023", "Luxor, Egypt, 47th", "World Finals"],
["2022", "Luxor, Egypt, 46th", "World Finals"],
["2021", "Dhaka, Bangladesh", "World Finals"],
["2020", "Moscow, Russia", "World Finals"],
["2019", "Porto, Portugal", "World Finals"],
["2018", "Beijing, China", "World Finals"],
["2017", "Rapid City, SD, USA", "World Finals"],
["2016", "Phuket, Thailand", "World Finals"],
["2015", "Marrakesh, Morocco", "World Finals"],
["2014", "Ekaterinburg, Russia", "World Finals"],
["2013", "Saint Petersburg, Russia", "World Finals"],
["2012", "Warsaw, Poland", "World Finals"],
["2011", "Orlando FL, USA", "World Finals"],
["2010", "Harbin, China", "World Finals"],
["2009", "Stockholm, Sweden", "World Finals"],
["2008", "Banff, Canada", "World Finals"],
["2007", "Tokyo, Japan", "World Finals"],
["2006", "San Antonio, TX, USA", "World Finals"],
["2005", "Shanghai, China", "World Finals"],
["2004", "Prague, Czech Republic", "World Finals"],
["2003", "Beverly Hills, CA, USA", "World Finals"],
["2002", "Honolulu, Hawaii, USA", "World Finals"],
["2001", "Vancouver, Canada", "World Finals"]
["2023", "Luxor, Egypt, 47th", "World Finals"],
["2022", "Luxor, Egypt, 46th", "World Finals"],
["2021", "Dhaka, Bangladesh", "World Finals"],
["2020", "Moscow, Russia", "World Finals"],
["2019", "Porto, Portugal", "World Finals"],
["2018", "Beijing, China", "World Finals"],
["2017", "Rapid City, SD, USA", "World Finals"],
["2016", "Phuket, Thailand", "World Finals"],
["2015", "Marrakesh, Morocco", "World Finals"],
["2014", "Ekaterinburg, Russia", "World Finals"],
["2013", "Saint Petersburg, Russia", "World Finals"],
["2012", "Warsaw, Poland", "World Finals"],
["2011", "Orlando FL, USA", "World Finals"],
["2010", "Harbin, China", "World Finals"],
["2009", "Stockholm, Sweden", "World Finals"],
["2008", "Banff, Canada", "World Finals"],
["2007", "Tokyo, Japan", "World Finals"],
["2006", "San Antonio, TX, USA", "World Finals"],
["2005", "Shanghai, China", "World Finals"],
["2004", "Prague, Czech Republic", "World Finals"],
["2003", "Beverly Hills, CA, USA", "World Finals"],
["2002", "Honolulu, Hawaii, USA", "World Finals"],
["2001", "Vancouver, Canada", "World Finals"],
];


export const api_key = "d30033b3d833adaace90f8487da70bba";
export const user_id = "141939107@N06";
export const title = "ICPC Gallery";
export const description = "The International Collegiate Programming Contest World Finals Photo Gallery.";
export const description =
"The International Collegiate Programming Contest World Finals Photo Gallery.";

export const FLICKR_IMAGE_PREFIX = "https://www.flickr.com/photos/icpcnews/";
export const SUGGESTIONS_EMAIL = "[email protected]";
Expand Down
5 changes: 2 additions & 3 deletions dataACPC/consts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export const places = [
["RC 2023-2024", "Regional Contests", ""],
["2023", "", ""]
["RC 2023-2024", "Regional Contests", ""],
["2023", "", ""],
];


export const api_key = "d30033b3d833adaace90f8487da70bba";
export const user_id = "141939107@N06";
export const title = "ACPC Gallery";
Expand Down
5 changes: 2 additions & 3 deletions dataAE/consts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export const places = [
["RC 2023-2024", "Regional Contests", ""],
["2023", "", ""]
["RC 2023-2024", "Regional Contests", ""],
["2023", "", ""],
];


export const api_key = "d30033b3d833adaace90f8487da70bba";
export const user_id = "141939107@N06";
export const title = "Asia East Gallery";
Expand Down
5 changes: 2 additions & 3 deletions dataAP/consts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export const places = [
["2024", "", ""],
["RC 2023-2024", "Regional Contests", ""]
["2024", "", ""],
["RC 2023-2024", "Regional Contests", ""],
];


export const api_key = "d30033b3d833adaace90f8487da70bba";
export const user_id = "141939107@N06";
export const title = "Asia Pacific Gallery";
Expand Down
5 changes: 2 additions & 3 deletions dataAW/consts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export const places = [
["RC 2023-2024", "Regional Contests", ""],
["2023", "", ""]
["RC 2023-2024", "Regional Contests", ""],
["2023", "", ""],
];


export const api_key = "d30033b3d833adaace90f8487da70bba";
export const user_id = "141939107@N06";
export const title = "Asia West Gallery";
Expand Down
5 changes: 2 additions & 3 deletions dataEU/consts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export const places = [
["2024", "EUC, Prague", ""],
["RC 2023-2024", "Regional Contests", ""]
["2024", "EUC, Prague", ""],
["RC 2023-2024", "Regional Contests", ""],
];


export const api_key = "d30033b3d833adaace90f8487da70bba";
export const user_id = "141939107@N06";
export const title = "Europe Gallery";
Expand Down
Loading

0 comments on commit 13e36b4

Please sign in to comment.