diff --git a/README.md b/README.md index d198dba..92153fe 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.3. +## How to run backend (Express App) + +1. Navigate to **backend** folder by `cd backend/` +2. Install dependencies `yarn install` +3. Run the express server `yarn start` +4. Open the URL `http://localhost:3000/places` in your browser + ## Cloning Guide 1. Clone only the remote primary HEAD (default: origin/master) @@ -224,3 +231,4 @@ To configure the pre-commit hook, simply add a `precommit` npm script. We want t - [GitHub Actions for Angular](https://github.com/rodrigokamada/angular-github-actions) - [Angular 16 - milestone release](https://github.com/actionanand/ng16-signal-milestone-release) +- [Colorful Console Message](https://www.samanthaming.com/tidbits/40-colorful-console-message/) diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..63c53ae --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,42 @@ +# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. + +# Compiled output +/dist +/tmp +/out-tsc +/bazel-out + +# Node +/node_modules +npm-debug.log +yarn-error.log + +# IDEs and editors +.idea/ +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# Visual Studio Code +# .vscode/* +# !.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +# !.vscode/extensions.json +.history/* + +# Miscellaneous +/.angular/cache +.sass-cache/ +/connect.lock +/coverage +/libpeerconnection.log +testem.log +/typings + +# System files +.DS_Store +Thumbs.db diff --git a/backend/app.js b/backend/app.js new file mode 100644 index 0000000..bc90de2 --- /dev/null +++ b/backend/app.js @@ -0,0 +1,94 @@ +import fs from "node:fs/promises"; + +import bodyParser from "body-parser"; +import express from "express"; + +const app = express(); + +app.use(express.static("images")); +app.use(bodyParser.json()); + +// CORS + +app.use((req, res, next) => { + res.setHeader("Access-Control-Allow-Origin", "*"); // allow all domains + res.setHeader("Access-Control-Allow-Methods", "GET, PUT, DELETE"); + res.setHeader("Access-Control-Allow-Headers", "Content-Type"); + + next(); +}); + +app.get("/places", async (req, res) => { + await new Promise((resolve) => setTimeout(resolve, 3000)); + + const fileContent = await fs.readFile("./data/places.json"); + + const placesData = JSON.parse(fileContent); + + res.status(200).json({ places: placesData }); +}); + +app.get("/user-places", async (req, res) => { + const fileContent = await fs.readFile("./data/user-places.json"); + + const places = JSON.parse(fileContent); + + res.status(200).json({ places }); +}); + +app.put("/user-places", async (req, res) => { + const placeId = req.body.placeId; + + const fileContent = await fs.readFile("./data/places.json"); + const placesData = JSON.parse(fileContent); + + const place = placesData.find((place) => place.id === placeId); + + const userPlacesFileContent = await fs.readFile("./data/user-places.json"); + const userPlacesData = JSON.parse(userPlacesFileContent); + + let updatedUserPlaces = userPlacesData; + + if (!userPlacesData.some((p) => p.id === place.id)) { + updatedUserPlaces = [...userPlacesData, place]; + } + + await fs.writeFile( + "./data/user-places.json", + JSON.stringify(updatedUserPlaces) + ); + + res.status(200).json({ userPlaces: updatedUserPlaces }); +}); + +app.delete("/user-places/:id", async (req, res) => { + const placeId = req.params.id; + + const userPlacesFileContent = await fs.readFile("./data/user-places.json"); + const userPlacesData = JSON.parse(userPlacesFileContent); + + const placeIndex = userPlacesData.findIndex((place) => place.id === placeId); + + let updatedUserPlaces = userPlacesData; + + if (placeIndex >= 0) { + updatedUserPlaces.splice(placeIndex, 1); + } + + await fs.writeFile( + "./data/user-places.json", + JSON.stringify(updatedUserPlaces) + ); + + res.status(200).json({ userPlaces: updatedUserPlaces }); +}); + +// 404 +app.use((req, res, next) => { + if (req.method === "OPTIONS") { + return next(); + } + res.status(404).json({ message: "404 - Not Found" }); +}); + +app.listen(3000); diff --git a/backend/data/places.json b/backend/data/places.json new file mode 100644 index 0000000..6122c65 --- /dev/null +++ b/backend/data/places.json @@ -0,0 +1,182 @@ +[ + { + "id": "p1", + "title": "Forest Waterfall", + "image": { + "src": "forest-waterfall.jpg", + "alt": "A tranquil forest with a cascading waterfall amidst greenery." + }, + "lat": 44.5588, + "lon": -80.344 + }, + { + "id": "p2", + "title": "Sahara Desert Dunes", + "image": { + "src": "desert-dunes.jpg", + "alt": "Golden dunes stretching to the horizon in the Sahara Desert." + }, + "lat": 25.0, + "lon": 0.0 + }, + { + "id": "p3", + "title": "Himalayan Peaks", + "image": { + "src": "majestic-mountains.jpg", + "alt": "The sun setting behind snow-capped peaks of majestic mountains." + }, + "lat": 27.9881, + "lon": 86.925 + }, + { + "id": "p4", + "title": "Caribbean Beach", + "image": { + "src": "caribbean-beach.jpg", + "alt": "Pristine white sand and turquoise waters of a Caribbean beach." + }, + "lat": 18.2208, + "lon": -66.5901 + }, + { + "id": "p5", + "title": "Ancient Grecian Ruins", + "image": { + "src": "ruins.jpg", + "alt": "Historic ruins standing tall against the backdrop of the Grecian sky." + }, + "lat": 37.9715, + "lon": 23.7257 + }, + { + "id": "p6", + "title": "Amazon Rainforest Canopy", + "image": { + "src": "rainforest.jpg", + "alt": "Lush canopy of a rainforest, teeming with life." + }, + "lat": -3.4653, + "lon": -62.2159 + }, + { + "id": "p7", + "title": "Northern Lights", + "image": { + "src": "northern-lights.jpg", + "alt": "Dazzling display of the Northern Lights in a starry sky." + }, + "lat": 64.9631, + "lon": -19.0208 + }, + { + "id": "p8", + "title": "Japanese Temple", + "image": { + "src": "japanese-temple.jpg", + "alt": "Ancient Japanese temple surrounded by autumn foliage." + }, + "lat": 34.9949, + "lon": 135.785 + }, + { + "id": "p9", + "title": "Great Barrier Reef", + "image": { + "src": "great-barrier-reef.jpg", + "alt": "Vibrant coral formations of the Great Barrier Reef underwater." + }, + "lat": -18.2871, + "lon": 147.6992 + }, + { + "id": "p10", + "title": "Parisian Streets", + "image": { + "src": "parisian-streets.jpg", + "alt": "Charming streets of Paris with historic buildings and cafes." + }, + "lat": 48.8566, + "lon": 2.3522 + }, + { + "id": "p11", + "title": "Grand Canyon", + "image": { + "src": "grand-canyon.jpg", + "alt": "Expansive view of the deep gorges and ridges of the Grand Canyon." + }, + "lat": 36.1069, + "lon": -112.1129 + }, + { + "id": "p12", + "title": "Venetian Canals", + "image": { + "src": "venetian-canals.jpg", + "alt": "Glistening waters of the Venetian canals as gondolas glide by at sunset." + }, + "lat": 45.4408, + "lon": 12.3155 + }, + { + "id": "p13", + "title": "Taj Mahal", + "image": { + "src": "taj-mahal.jpg", + "alt": "The iconic Taj Mahal reflecting in its surrounding waters during sunrise." + }, + "lat": 27.1751, + "lon": 78.0421 + }, + { + "id": "p14", + "title": "Kerala Backwaters", + "image": { + "src": "kerala-backwaters.jpg", + "alt": "Tranquil waters and lush greenery of the Kerala backwaters." + }, + "lat": 9.4981, + "lon": 76.3388 + }, + { + "id": "p15", + "title": "African Savanna", + "image": { + "src": "african-savanna.jpg", + "alt": "Wild animals roaming freely in the vast landscapes of the African savanna." + }, + "lat": -2.153, + "lon": 34.6857 + }, + { + "id": "p16", + "title": "Victoria Falls", + "image": { + "src": "victoria-falls.jpg", + "alt": "The powerful cascade of Victoria Falls, a natural wonder between Zambia and Zimbabwe." + }, + "lat": -17.9243, + "lon": 25.8572 + }, + { + "id": "p17", + "title": "Machu Picchu", + "image": { + "src": "machu-picchu.jpg", + "alt": "The historic Incan citadel of Machu Picchu illuminated by the morning sun." + }, + "lat": -13.1631, + "lon": -72.545 + }, + { + "id": "p18", + "title": "Amazon River", + "image": { + "src": "amazon-river.jpg", + "alt": "Navigating the waters of the Amazon River, surrounded by dense rainforest." + }, + "lat": -3.4653, + "lon": -58.38 + } +] diff --git a/backend/data/user-places.json b/backend/data/user-places.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/backend/data/user-places.json @@ -0,0 +1 @@ +[] diff --git a/backend/images/african-savanna.jpg b/backend/images/african-savanna.jpg new file mode 100644 index 0000000..2c9cd1f Binary files /dev/null and b/backend/images/african-savanna.jpg differ diff --git a/backend/images/amazon-river.jpg b/backend/images/amazon-river.jpg new file mode 100644 index 0000000..9260a48 Binary files /dev/null and b/backend/images/amazon-river.jpg differ diff --git a/backend/images/caribbean-beach.jpg b/backend/images/caribbean-beach.jpg new file mode 100644 index 0000000..1af2cfe Binary files /dev/null and b/backend/images/caribbean-beach.jpg differ diff --git a/backend/images/desert-dunes.jpg b/backend/images/desert-dunes.jpg new file mode 100644 index 0000000..700cdcc Binary files /dev/null and b/backend/images/desert-dunes.jpg differ diff --git a/backend/images/forest-waterfall.jpg b/backend/images/forest-waterfall.jpg new file mode 100644 index 0000000..ecfeafc Binary files /dev/null and b/backend/images/forest-waterfall.jpg differ diff --git a/backend/images/grand-canyon.jpg b/backend/images/grand-canyon.jpg new file mode 100644 index 0000000..67bd004 Binary files /dev/null and b/backend/images/grand-canyon.jpg differ diff --git a/backend/images/great-barrier-reef.jpg b/backend/images/great-barrier-reef.jpg new file mode 100644 index 0000000..0c986b9 Binary files /dev/null and b/backend/images/great-barrier-reef.jpg differ diff --git a/backend/images/japanese-temple.jpg b/backend/images/japanese-temple.jpg new file mode 100644 index 0000000..26c04f0 Binary files /dev/null and b/backend/images/japanese-temple.jpg differ diff --git a/backend/images/kerala-backwaters.jpg b/backend/images/kerala-backwaters.jpg new file mode 100644 index 0000000..5b57c4c Binary files /dev/null and b/backend/images/kerala-backwaters.jpg differ diff --git a/backend/images/machu-picchu.jpg b/backend/images/machu-picchu.jpg new file mode 100644 index 0000000..5c9071d Binary files /dev/null and b/backend/images/machu-picchu.jpg differ diff --git a/backend/images/majestic-mountains.jpg b/backend/images/majestic-mountains.jpg new file mode 100644 index 0000000..864daf3 Binary files /dev/null and b/backend/images/majestic-mountains.jpg differ diff --git a/backend/images/northern-lights.jpg b/backend/images/northern-lights.jpg new file mode 100644 index 0000000..e3cd27f Binary files /dev/null and b/backend/images/northern-lights.jpg differ diff --git a/backend/images/parisian-streets.jpg b/backend/images/parisian-streets.jpg new file mode 100644 index 0000000..e18fb6c Binary files /dev/null and b/backend/images/parisian-streets.jpg differ diff --git a/backend/images/rainforest.jpg b/backend/images/rainforest.jpg new file mode 100644 index 0000000..76cdb14 Binary files /dev/null and b/backend/images/rainforest.jpg differ diff --git a/backend/images/ruins.jpg b/backend/images/ruins.jpg new file mode 100644 index 0000000..2f94a0d Binary files /dev/null and b/backend/images/ruins.jpg differ diff --git a/backend/images/taj-mahal.jpg b/backend/images/taj-mahal.jpg new file mode 100644 index 0000000..698b722 Binary files /dev/null and b/backend/images/taj-mahal.jpg differ diff --git a/backend/images/venetian-canals.jpg b/backend/images/venetian-canals.jpg new file mode 100644 index 0000000..81c4ed5 Binary files /dev/null and b/backend/images/venetian-canals.jpg differ diff --git a/backend/images/victoria-falls.jpg b/backend/images/victoria-falls.jpg new file mode 100644 index 0000000..de4ab18 Binary files /dev/null and b/backend/images/victoria-falls.jpg differ diff --git a/backend/package.json b/backend/package.json new file mode 100644 index 0000000..f418056 --- /dev/null +++ b/backend/package.json @@ -0,0 +1,20 @@ +{ + "name": "backend", + "version": "1.0.0", + "description": "", + "main": "index.js", + "type": "module", + "scripts": { + "start": "node app.js" + }, + "keywords": [], + "author": "Anand Raja", + "license": "ISC", + "dependencies": { + "body-parser": "^1.20.2", + "express": "^4.18.2" + }, + "engines": { + "node": "20" + } +} diff --git a/backend/yarn.lock b/backend/yarn.lock new file mode 100644 index 0000000..cf54d6a --- /dev/null +++ b/backend/yarn.lock @@ -0,0 +1,468 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +accepts@~1.3.8: + version "1.3.8" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" + integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== + dependencies: + mime-types "~2.1.34" + negotiator "0.6.3" + +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + +body-parser@1.20.3, body-parser@^1.20.2: + version "1.20.3" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" + integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== + dependencies: + bytes "3.1.2" + content-type "~1.0.5" + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" + iconv-lite "0.4.24" + on-finished "2.4.1" + qs "6.13.0" + raw-body "2.5.2" + type-is "~1.6.18" + unpipe "1.0.0" + +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + +call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +content-type@~1.0.4, content-type@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" + integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== + +cookie@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== + +debug@2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== + +encodeurl@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" + integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== + +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== + +express@^4.18.2: + version "4.21.0" + resolved "https://registry.yarnpkg.com/express/-/express-4.21.0.tgz#d57cb706d49623d4ac27833f1cbc466b668eb915" + integrity sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng== + dependencies: + accepts "~1.3.8" + array-flatten "1.1.1" + body-parser "1.20.3" + content-disposition "0.5.4" + content-type "~1.0.4" + cookie "0.6.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "2.0.0" + encodeurl "~2.0.0" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.3.1" + fresh "0.5.2" + http-errors "2.0.0" + merge-descriptors "1.0.3" + methods "~1.1.2" + on-finished "2.4.1" + parseurl "~1.3.3" + path-to-regexp "0.1.10" + proxy-addr "~2.0.7" + qs "6.13.0" + range-parser "~1.2.1" + safe-buffer "5.2.1" + send "0.19.0" + serve-static "1.16.2" + setprototypeof "1.2.0" + statuses "2.0.1" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + +finalhandler@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" + integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== + dependencies: + debug "2.6.9" + encodeurl "~2.0.0" + escape-html "~1.0.3" + on-finished "2.4.1" + parseurl "~1.3.3" + statuses "2.0.1" + unpipe "~1.0.0" + +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== + +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +hasown@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +inherits@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== + +merge-descriptors@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5" + integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ== + +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@~2.1.24, mime-types@~2.1.34: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +negotiator@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== + +object-inspect@^1.13.1: + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== + +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + dependencies: + ee-first "1.1.1" + +parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + +path-to-regexp@0.1.10: + version "0.1.10" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b" + integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w== + +proxy-addr@~2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" + integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + +qs@6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" + integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== + dependencies: + side-channel "^1.0.6" + +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + +safe-buffer@5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +send@0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" + integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== + dependencies: + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "2.0.0" + mime "1.6.0" + ms "2.1.3" + on-finished "2.4.1" + range-parser "~1.2.1" + statuses "2.0.1" + +serve-static@1.16.2: + version "1.16.2" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" + integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== + dependencies: + encodeurl "~2.0.0" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.19.0" + +set-function-length@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + +side-channel@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" + integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + object-inspect "^1.13.1" + +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + +type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== + +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..ec406fd Binary files /dev/null and b/public/logo.png differ diff --git a/src/app/app.component.css b/src/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/app.component.html b/src/app/app.component.html index d60198e..4e8e110 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,14 @@ -{{ title }} +
+ Stylized globe +

PlacePicker

+

+ Create your personal collection of places you would like to visit or you + have visited. +

+
+
+ - + +
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5323296..b14786a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,13 +1,24 @@ import { Component } from '@angular/core'; -import { RouterOutlet } from '@angular/router'; + +import { AvailablePlacesComponent } from './places/available-places/available-places.component'; +import { UserPlacesComponent } from './places/user-places/user-places.component'; @Component({ selector: 'app-root', standalone: true, - imports: [RouterOutlet], templateUrl: './app.component.html', - styleUrl: './app.component.scss' + styleUrl: './app.component.css', + imports: [AvailablePlacesComponent, UserPlacesComponent], }) export class AppComponent { - title = 'Essentials 18'; + styles = ['color: indigo', 'background: #90EE90', 'font-weight: bold', 'font-size: 18px'].join(';'); + + constructor() { + console.log( + '%cUse local setup by cloning the project to see it in full power with backend api calls.', + 'color: green; background: yellow; font-size: 23px', + ); + console.log('%c%s', this.styles, `git clone https://github.com/actionanand/angular-http-project.git`); + console.log('GitHub Location: ' + 'https://github.com/actionanand/angular-http-project'); + } } diff --git a/src/app/places/available-places/available-places.component.css b/src/app/places/available-places/available-places.component.css new file mode 100644 index 0000000..a20e039 --- /dev/null +++ b/src/app/places/available-places/available-places.component.css @@ -0,0 +1,3 @@ +.fallback-text { + text-align: center; +} diff --git a/src/app/places/available-places/available-places.component.html b/src/app/places/available-places/available-places.component.html new file mode 100644 index 0000000..67a3fbc --- /dev/null +++ b/src/app/places/available-places/available-places.component.html @@ -0,0 +1,7 @@ + + @if (places()) { + + } @else if (places()?.length === 0) { +

Unfortunately, no places could be found.

+ } +
diff --git a/src/app/places/available-places/available-places.component.ts b/src/app/places/available-places/available-places.component.ts new file mode 100644 index 0000000..325a316 --- /dev/null +++ b/src/app/places/available-places/available-places.component.ts @@ -0,0 +1,16 @@ +import { Component, signal } from '@angular/core'; + +import { Place } from '../place.model'; +import { PlacesComponent } from '../places.component'; +import { PlacesContainerComponent } from '../places-container/places-container.component'; + +@Component({ + selector: 'app-available-places', + standalone: true, + templateUrl: './available-places.component.html', + styleUrl: './available-places.component.css', + imports: [PlacesComponent, PlacesContainerComponent], +}) +export class AvailablePlacesComponent { + places = signal(undefined); +} diff --git a/src/app/places/place.model.ts b/src/app/places/place.model.ts new file mode 100644 index 0000000..3d4a01e --- /dev/null +++ b/src/app/places/place.model.ts @@ -0,0 +1,10 @@ +export interface Place { + id: string; + title: string; + image: { + src: string; + alt: string; + }; + lat: number; + lon: number; +} diff --git a/src/app/places/places-container/places-container.component.css b/src/app/places/places-container/places-container.component.css new file mode 100644 index 0000000..15f009c --- /dev/null +++ b/src/app/places/places-container/places-container.component.css @@ -0,0 +1,17 @@ +section { + max-width: 85rem; + margin: 2rem auto; + padding: 1rem; + border: 2px solid #0d373e; + border-radius: 8px; +} + +section h2 { + font-family: "Raleway", sans-serif; + font-size: 1.5rem; + margin: 0; + padding: 0; + margin-bottom: 1rem; + color: #8feeff; + text-align: center; +} diff --git a/src/app/places/places-container/places-container.component.html b/src/app/places/places-container/places-container.component.html new file mode 100644 index 0000000..f39c039 --- /dev/null +++ b/src/app/places/places-container/places-container.component.html @@ -0,0 +1,4 @@ +
+

{{ title() }}

+ +
diff --git a/src/app/places/places-container/places-container.component.ts b/src/app/places/places-container/places-container.component.ts new file mode 100644 index 0000000..51304bf --- /dev/null +++ b/src/app/places/places-container/places-container.component.ts @@ -0,0 +1,12 @@ +import { Component, input } from '@angular/core'; + +@Component({ + selector: 'app-places-container', + standalone: true, + imports: [], + templateUrl: './places-container.component.html', + styleUrl: './places-container.component.css' +}) +export class PlacesContainerComponent { + title = input.required(); +} diff --git a/src/app/places/places.component.css b/src/app/places/places.component.css new file mode 100644 index 0000000..4d832f3 --- /dev/null +++ b/src/app/places/places.component.css @@ -0,0 +1,61 @@ +ul { + max-width: 80rem; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); + grid-gap: 2rem; + margin: 2rem auto; + padding: 0; + list-style: none; +} + +.place-item { + position: relative; + display: flex; + flex-direction: column; + border-radius: 8px; + background: #1f1c2c; + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); + animation: slide-up-fade-in 0.3s ease-out forwards; +} + +.place-item button { + background: transparent; + border: none; + padding: 0; + transition: all 0.2s ease-in-out; +} + +.place-item:nth-child(odd) button:hover, +.place-item:nth-child(odd) button:focus { + box-shadow: 0 0 8px 4px rgba(255, 217, 0, 0.6); + border-radius: 8px; + transform: rotate(5deg); +} + +.place-item:nth-child(even) button:hover, +.place-item:nth-child(even) button:focus { + box-shadow: 0 0 8px 4px rgba(255, 217, 0, 0.6); + border-radius: 8px; + transform: rotate(-5deg); +} + +.place-item img { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 0.5rem; +} + +.place-item h3 { + font-family: "Raleway", sans-serif; + font-weight: normal; + font-size: 0.9rem; + position: absolute; + bottom: 0; + right: 1rem; + margin: 1rem auto; + background-color: #feee86; + border-radius: 4px; + padding: 0.15rem 0.35rem; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); +} diff --git a/src/app/places/places.component.html b/src/app/places/places.component.html new file mode 100644 index 0000000..4b4c15b --- /dev/null +++ b/src/app/places/places.component.html @@ -0,0 +1,13 @@ + diff --git a/src/app/places/places.component.ts b/src/app/places/places.component.ts new file mode 100644 index 0000000..790baf7 --- /dev/null +++ b/src/app/places/places.component.ts @@ -0,0 +1,19 @@ +import { Component, input, output } from '@angular/core'; + +import { Place } from './place.model'; + +@Component({ + selector: 'app-places', + standalone: true, + imports: [], + templateUrl: './places.component.html', + styleUrl: './places.component.css', +}) +export class PlacesComponent { + places = input.required(); + selectPlace = output(); + + onSelectPlace(place: Place) { + this.selectPlace.emit(place); + } +} diff --git a/src/app/places/places.service.ts b/src/app/places/places.service.ts new file mode 100644 index 0000000..bdcd6d0 --- /dev/null +++ b/src/app/places/places.service.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { Injectable, signal } from '@angular/core'; + +import { Place } from './place.model'; + +@Injectable({ + providedIn: 'root', +}) +export class PlacesService { + private userPlaces = signal([]); + + loadedUserPlaces = this.userPlaces.asReadonly(); + + loadAvailablePlaces() {} + + loadUserPlaces() {} + + addPlaceToUserPlaces(place: Place) {} + + removeUserPlace(place: Place) {} +} diff --git a/src/app/places/user-places/user-places.component.css b/src/app/places/user-places/user-places.component.css new file mode 100644 index 0000000..a20e039 --- /dev/null +++ b/src/app/places/user-places/user-places.component.css @@ -0,0 +1,3 @@ +.fallback-text { + text-align: center; +} diff --git a/src/app/places/user-places/user-places.component.html b/src/app/places/user-places/user-places.component.html new file mode 100644 index 0000000..1cb1786 --- /dev/null +++ b/src/app/places/user-places/user-places.component.html @@ -0,0 +1,3 @@ + +

Todo...

+
diff --git a/src/app/places/user-places/user-places.component.ts b/src/app/places/user-places/user-places.component.ts new file mode 100644 index 0000000..6ea8d09 --- /dev/null +++ b/src/app/places/user-places/user-places.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; + +import { PlacesContainerComponent } from '../places-container/places-container.component'; +import { PlacesComponent } from '../places.component'; + +@Component({ + selector: 'app-user-places', + standalone: true, + templateUrl: './user-places.component.html', + styleUrl: './user-places.component.css', + imports: [PlacesContainerComponent, PlacesComponent], +}) +export class UserPlacesComponent { +} diff --git a/src/index.html b/src/index.html index 9cb3d7e..52e6988 100644 --- a/src/index.html +++ b/src/index.html @@ -2,10 +2,10 @@ - Investment Calculator + PlacePicker - + diff --git a/src/main.ts b/src/main.ts index 35b00f3..b0dee4b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import { bootstrapApplication } from '@angular/platform-browser'; -import { appConfig } from './app/app.config'; + import { AppComponent } from './app/app.component'; -bootstrapApplication(AppComponent, appConfig) - .catch((err) => console.error(err)); + +bootstrapApplication(AppComponent).catch((err) => console.error(err)); diff --git a/src/styles.scss b/src/styles.scss index 90d4ee0..ec47262 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1 +1,51 @@ -/* You can add global styles to this file, and also import other style files */ +@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@10..48,400;10..48,700&family=Raleway:wght@400;700&display=swap"); + +* { + box-sizing: border-box; +} + +html { + font-family: "Bricolage Grotesque", sans-serif; + line-height: 1.5; + + color: #defaf8; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; + height: 100%; +} + +body { + margin: 0; + padding: 2rem; + background: linear-gradient(180deg, #1f1c2c 0%, #1f1c2c 100%); +} + +header { + text-align: center; +} + +header img { + width: 5rem; + height: 5rem; + object-fit: contain; + filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.4)); +} + +header h1 { + margin: 0; + font-size: 3rem; + text-transform: uppercase; + letter-spacing: 1rem; +} + +header p { + margin: 0 auto; + font-size: 1.15rem; + max-width: 38ch; + color: #9eb5b4; +} +