diff --git a/.eslintrc.json b/.eslintrc.json index 2c1df9d..efad951 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -71,6 +71,11 @@ "group": "builtin", "position": "before" }, + { + "pattern": "@customTypes/**", + "group": "builtin", + "position": "before" + }, { "pattern": "@services/**", "group": "builtin", diff --git a/package-lock.json b/package-lock.json index f2b642a..e090f0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9379,10 +9379,32 @@ } }, "node_modules/ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", - "dev": true + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/ipaddr.js": { "version": "2.0.1", @@ -10082,6 +10104,13 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true, + "license": "MIT" + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -14212,16 +14241,17 @@ } }, "node_modules/socks": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz", - "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", + "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", "dev": true, + "license": "MIT", "dependencies": { - "ip": "^1.1.5", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 10.13.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, @@ -14654,20 +14684,21 @@ } }, "node_modules/tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, + "license": "ISC", "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" }, "engines": { - "node": ">= 10" + "node": ">=10" } }, "node_modules/tar-stream": { @@ -14686,6 +14717,16 @@ "node": ">=6" } }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, "node_modules/terser": { "version": "5.14.2", "resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz", @@ -22617,11 +22658,29 @@ } }, "ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.9.tgz", + "integrity": "sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==", "dev": true }, + "ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "requires": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "dependencies": { + "sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true + } + } + }, "ipaddr.js": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz", @@ -23113,6 +23172,12 @@ "esprima": "^4.0.0" } }, + "jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -26122,12 +26187,12 @@ } }, "socks": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz", - "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", + "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", "dev": true, "requires": { - "ip": "^1.1.5", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" } }, @@ -26437,17 +26502,25 @@ "dev": true }, "tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true + } } }, "tar-stream": { diff --git a/src/app/core/components/sidebar/sidebar.component.css b/src/app/core/components/sidebar/sidebar.component.css index 1d4d72b..1bdec64 100644 --- a/src/app/core/components/sidebar/sidebar.component.css +++ b/src/app/core/components/sidebar/sidebar.component.css @@ -1,20 +1,17 @@ nav { position: fixed; height: 100%; - width: 250px; - border-right: 1px solid #a5a5a5; - padding: 6px 14px; + border-right: var(--border); z-index: 103; transition: 0.5s ease; - padding: 0 0.2rem; + padding: 0 1rem; display: flex; flex-direction: column; align-items: flex-start; - gap: 10px; } nav .logo-details { - height: 60px; + height: 70px; width: 100%; display: flex; align-items: center; @@ -52,12 +49,6 @@ nav.open .logo-details .toggled { position: initial; } -nav i { - color: var(--bg-color-secondary); - min-width: 60px; - font-size: 28px; - text-align: center; -} nav .nav-list { width: 100%; @@ -77,22 +68,23 @@ nav li.mobile { } nav li .tooltip { - position: absolute; - top: -20px; - left: calc(100% + 15px); - z-index: 3; - color: var(--font-color-primary); background: var(--bg-color-card); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3); - padding: 6px 12px; border-radius: 4px; + border: var(--border); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3); + color: var(--font-color-primary); + display: none; font-size: 15px; - font-weight: 400; + font-weight: 500; + left: calc(100% + 25px); opacity: 0; - white-space: nowrap; + padding: 6px 12px; pointer-events: none; + position: absolute; + top: -20px; transition: 0s; - display: none; + white-space: nowrap; + z-index: 3; } nav li:hover .tooltip { @@ -104,32 +96,33 @@ nav li:hover .tooltip { } nav li a { - display: flex; - height: 100%; - width: 100%; - border-radius: 40px; align-items: center; - text-decoration: none; - transition: 0.5s ease; background: transparent; + border-radius: 40px; + color: var(--font-color-secondary); cursor: pointer; + display: flex; + font-size: 18px; + font-weight: 600; + gap: 0.8rem; + height: 100%; + padding: 0; + text-decoration: none; + transition: 0.2s ease; + width: 100%; } nav li a:hover, -.profile .profile-details:hover, -.active { - background: var(--bg-hover) !important; +nav li a.active, +.profile .profile-details:hover { + color: var(--font-color-primary); } nav li a .links_name { - color: var(--font-color-primary); - font-size: 19px; - font-weight: 500; white-space: nowrap; opacity: 0; letter-spacing: 1px; pointer-events: none; - transition: 0.4s; opacity: 1; } @@ -139,8 +132,9 @@ nav li a:hover i { } nav li i { - font-size: 30px; + font-size: 32px; border-radius: 12px; + min-width: fit-content; } nav .profile { @@ -220,6 +214,11 @@ nav .profile { @media (max-width: 1280px) { nav { width: 80px; + align-items: center; + } + + nav .nav-list { + width: fit-content; } nav li .tooltip { @@ -281,7 +280,7 @@ nav .profile { transition: none; background: var(--bg-color); border-right: none; - border-top: 1px solid #a5a5a5; + border-top: var(--border); } nav .profile, @@ -293,13 +292,10 @@ nav .profile { nav .nav-list { flex-direction: row; bottom: 0; - justify-content: space-evenly; + justify-content: center; + gap: 4px; } - /* nav li { - padding: 10px 0; - } */ - nav li .tooltip { display: none; } diff --git a/src/app/core/components/sidebar/sidebar.component.html b/src/app/core/components/sidebar/sidebar.component.html index 8123d0a..dc43e3a 100644 --- a/src/app/core/components/sidebar/sidebar.component.html +++ b/src/app/core/components/sidebar/sidebar.component.html @@ -1,41 +1,40 @@ - InfoReader - + News News - + Explore Explore - + Search Search - + Saved Saved - + Settings Settings @@ -55,4 +54,4 @@ - \ No newline at end of file + diff --git a/src/app/core/mocks/feed.mock.ts b/src/app/core/mocks/feed.mock.ts index db06242..afe2f13 100644 --- a/src/app/core/mocks/feed.mock.ts +++ b/src/app/core/mocks/feed.mock.ts @@ -14,6 +14,8 @@ export const getFeedMock = (): Feed => ({ image: faker.datatype.string(), website: getWebsitesMock(), inUser: faker.datatype.boolean(), + liked: faker.datatype.boolean(), + likes: faker.datatype.number(), }); export const getFeedsMock = (size = 10): Feed[] => { diff --git a/src/app/core/models/feed.model.ts b/src/app/core/models/feed.model.ts index 314063e..971ef23 100644 --- a/src/app/core/models/feed.model.ts +++ b/src/app/core/models/feed.model.ts @@ -10,6 +10,8 @@ export class Feed { public link: string, public image: string, public website: Website, + public likes: number, public inUser?: boolean, + public liked?: boolean, ) {} } diff --git a/src/app/core/services/user.service.ts b/src/app/core/services/user.service.ts index 2a4e21c..a513f81 100644 --- a/src/app/core/services/user.service.ts +++ b/src/app/core/services/user.service.ts @@ -4,6 +4,8 @@ import { environment } from 'environments/environment'; import { Observable, map } from 'rxjs'; +import { OptionFeed } from '@customTypes/option.type'; + import { IResponseUser } from '@interfaces/response.interface'; import { IUser } from '@interfaces/user.interface'; @@ -31,7 +33,7 @@ export class UserService { private authService: AuthService, ) { } - modifyPreferences(resourceID: string, filter: 'subscription' | 'read' | 'saved') { + modifyPreferences(resourceID: string, filter: OptionFeed) { const url = `${base_url}/user/${filter}/${resourceID}`; return this.http.patch(url, {}, this.headers); } diff --git a/src/app/core/types/option.type.ts b/src/app/core/types/option.type.ts new file mode 100644 index 0000000..a4169d2 --- /dev/null +++ b/src/app/core/types/option.type.ts @@ -0,0 +1 @@ +export type OptionFeed = 'subscription' | 'read' | 'saved' | 'liked'; diff --git a/src/app/features/features.component.css b/src/app/features/features.component.css index 058f5b9..103029c 100644 --- a/src/app/features/features.component.css +++ b/src/app/features/features.component.css @@ -1,27 +1,29 @@ .wrapper { max-width: 1280px; margin: 0 auto; -} - -.wrapper.open .container { - margin-left: 80px; + display: grid; + grid-template-columns: minmax(80px, 20%) 1fr; } .wrapper .container { min-height: 100vh; - margin-left: 250px; width: auto; + padding: 0 1rem 0 0; } @media (max-width: 1280px) { - .wrapper .container { - margin-left: 78px; + .wrapper { + max-width: 100%; + grid-template-columns: 80px auto; } } @media (max-width: 768px) { + .wrapper { + grid-template-columns: 0 100%; + } .wrapper .container { - margin-left: 0 !important; margin-bottom: 55px !important; + padding: 0; } } diff --git a/src/app/features/home/components/websites-card/websites-card.component.css b/src/app/features/home/components/websites-card/websites-card.component.css index 0158ff1..09956a2 100644 --- a/src/app/features/home/components/websites-card/websites-card.component.css +++ b/src/app/features/home/components/websites-card/websites-card.component.css @@ -1,13 +1,12 @@ + .card.card-websites { cursor: default; opacity: 1; margin: 0; padding: 0 !important; - position: fixed; max-width: 300px; display: flex; flex-direction: column; - transform: translate(0, 78px); } .card.card-websites .card-title { diff --git a/src/app/features/home/components/websites-card/websites-card.component.html b/src/app/features/home/components/websites-card/websites-card.component.html index 837d296..6c93053 100644 --- a/src/app/features/home/components/websites-card/websites-card.component.html +++ b/src/app/features/home/components/websites-card/websites-card.component.html @@ -10,4 +10,4 @@ 'Following' : 'Subscribe' }} Show more... - \ No newline at end of file + diff --git a/src/app/features/home/home.component.css b/src/app/features/home/home.component.css index d56b7a0..9897107 100644 --- a/src/app/features/home/home.component.css +++ b/src/app/features/home/home.component.css @@ -1,7 +1,6 @@ .home-section { display: grid; - grid-template-columns: auto 300px; - gap: 0.5rem; + grid-template-columns: 1fr minmax(300px, 20%); } .home-section .websites { @@ -10,13 +9,18 @@ } .skeletons { - margin-top: 0.5rem; + display: flex; + flex-direction: column; + gap: 1rem; +} + +.news-container { + margin: 1rem; } .top-search { display: flex; align-items: center; - position: fixed; width: inherit; min-height: 70px; } @@ -25,6 +29,14 @@ width: 100%; } +.websites-wrapper { + position: sticky; + top: 0; + display: flex; + flex-direction: column; + gap: 1rem; +} + @media (max-width: 1200px) { .home-section .recently .news { grid-template-columns: repeat(1, 100%); diff --git a/src/app/features/home/home.component.html b/src/app/features/home/home.component.html index 6ef19eb..12f25f4 100644 --- a/src/app/features/home/home.component.html +++ b/src/app/features/home/home.component.html @@ -19,10 +19,12 @@ - - + + + + + + - - - \ No newline at end of file + diff --git a/src/app/shared/news-container/news-container.component.css b/src/app/shared/news-container/news-container.component.css index 560e4ad..2ca26b5 100644 --- a/src/app/shared/news-container/news-container.component.css +++ b/src/app/shared/news-container/news-container.component.css @@ -1,108 +1,253 @@ .news { display: grid; grid-template-columns: repeat(1, 100%); + gap: 1rem; } .card.card-new { display: flex; align-items: flex-start; - min-height: 13rem; - height: 13rem; - max-height: 13rem; + flex-direction: column; + min-height: 10rem; transition: 0.5s; -} - -.card.card.card-new:hover { - box-shadow: rgb(0 0 0 / 20%) 1px 1px 24px 1px; -} - -.card.card-new figure { - height: 100%; - width: 16rem; -} - -.card.card-new figure img { - object-fit: cover; - width: 100%; - height: 100%; - border-radius: 0.6rem 0 0 0.6rem; + padding: 1rem; + gap: 1rem; } .card.card-new .card-body { display: flex; - flex-direction: column; + flex-direction: row; + justify-content: space-between; height: 100%; width: 100%; flex-grow: 1; - padding: 1rem; gap: 10px; } -.card.card-new .card-body .title-wrapper { +.title-wrapper { display: flex; - justify-content: space-between; - font-size: 24px; + font-size: 22px; gap: 5px; + width: 100%; + flex-direction: column; } -.card.card-new .card-body .title-wrapper .new-title { +.title-wrapper .new-title { font-weight: 600; text-overflow: ellipsis; overflow: hidden; display: -webkit-box !important; + line-clamp: 3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; white-space: normal; - height: 108px; - max-height: 108px; + height: 100px; + max-height: 100px; + transition: 0.2s ease-in-out; + text-wrap: balance; } -.card.card-new .card-body .title-wrapper .new-title:hover { +.title-wrapper .new-title:hover { text-decoration: underline; + transition: 0.2s ease-in-out; } -.card.card-new .card-body .title-wrapper .new-title:hover, -.card.card-new .card-body .title-wrapper .save { +.title-wrapper .new-title:hover, +.title-wrapper .save { cursor: pointer; } -.card.card-new .card-body .title-wrapper .save { +.title-wrapper .save { color: var(--primary-color); margin-top: 5px; z-index: 10; } -.card.card.card-new .card-body .date { - flex-grow: 1; +.title-wrapper .website-name { + font-size: 15px; + color: var(--secondary-color); + font-weight: 500; +} + +.card-body .details { display: flex; - align-items: flex-end; - justify-content: flex-end; + gap: 10px; + align-items: center; + color: var(--font-color-secondary); +} + +.details .date, +.details .read { font-size: 13px; +} + +.details .bull { + font-size: 18px; +} + +.details-wrapper .options { + display: flex; + justify-content: center; + align-items: center; + width: fit-content; + gap: 0.6rem; + flex-wrap: wrap; + margin: 0 0 0 auto; +} + +.details-wrapper .options .separator { + height: 24px; + width: 0.1rem; + background: var(--separator-color); +} + +.details-wrapper .options .option { color: var(--font-color-secondary); + cursor: pointer; + padding: 3px 10px; + border-radius: 10px; + display: flex; + justify-content: center; + align-items: center; + gap: 6px; + min-height: 29px; } -.card.card.card-new .card-body .date span { +.details-wrapper .option.default { + cursor: default !important; +} + +.options .option:hover:has(.bx-like) { + background: #e66d9b2e; +} + +.options .option:hover:has(.bx-bookmark) { + background: #0098fa2e; +} + +.option .btn-icon { + color: var(--font-color-secondary); + width: 24px; + height: 24px; + cursor: pointer; + +} + +.details-wrapper .options .option i { + font-size: 20px; +} + +.bx-bookmark { + color: var(--primary-color); +} + +.bx-like { color: var(--secondary-color); - margin-left: 4px; - font-weight: 500; +} + +.bx-bookmark { + color: var(--primary-color); +} + +.bx { + position: relative; + display: inline-block; +} + +.bx-like::before, +.bx-bookmark::before { + position: absolute; + top: 0; + left: 0; + transition: opacity 0.3s ease, transform 0.3s ease; +} + +.bx::after { + top: 0; + left: 0; + opacity: 0; + transition: opacity 0.3s ease, transform 0.3s ease; +} + +.bx-like::after { + content: "\ed5f"; +} + +.bx-bookmark::after { + content: "\ec31"; +} + +.option:hover:has(.bx-like) .bx-like::before, +.option:hover:has(.bx-bookmark) .bx-bookmark::before { + opacity: 0; +} + +.option:hover:has(.bx-like) .bx-like::after, +.option:hover:has(.bx-bookmark) .bx-bookmark::after { + opacity: 1; +} + + +.details-wrapper { + display: flex; + justify-content: space-between; + align-items: center; + flex-direction: row; + height: 100%; + width: 100%; +} + +.details { + display: flex; + gap: 10px; + width: fit-content; + align-items: center; + color: var(--font-color-secondary); +} + + +figure { + height: 10.5rem; + width: 25rem; +} + +figure img { + object-fit: cover; + width: 100%; + height: 100%; + border-radius: 0.6rem; } @media (max-width: 480px) { .card.card-new { + padding: 0.6rem; + gap: 0.5rem; + } + + .card.card-new .card-body { + flex-direction: column-reverse; + } + + .details-wrapper { + width: 100%; flex-direction: column; - height: auto; - max-height: none; + align-items: flex-start; + justify-content: flex-end; + gap: 1rem; } - .card.card-new figure { - max-height: 9rem; + .details-wrapper .options { + align-self: center; + margin: 0; width: 100%; + justify-content: space-evenly; } - .card.card-new figure img { - border-radius: 0.6rem 0.6rem 0 0; + figure { + width: 100%; } - .card.card-new .card-body .title-wrapper .new-title { + + .title-wrapper .new-title { height: 90px; font-size: 20px; } diff --git a/src/app/shared/news-container/news-container.component.html b/src/app/shared/news-container/news-container.component.html index 3bcd55f..7610f52 100644 --- a/src/app/shared/news-container/news-container.component.html +++ b/src/app/shared/news-container/news-container.component.html @@ -1,21 +1,36 @@ - + - - - + {{ feed.website.name }} {{feed.title }} - - - - - {{ feed.pubDate | date: 'dd/MM/yyyy, h:mm a' }} • by - {{ feed.website.name }} - + + + + + + + {{ feed.pubDate | date: 'dd-MM-yyyy' }} + • + {{ 10 }} min + + + + + {{ 10 }} + + + + + 0"> {{ feed.likes }} + + + + + + - \ No newline at end of file + diff --git a/src/app/shared/news-container/news-container.component.ts b/src/app/shared/news-container/news-container.component.ts index 34e8b4b..73888e5 100644 --- a/src/app/shared/news-container/news-container.component.ts +++ b/src/app/shared/news-container/news-container.component.ts @@ -3,6 +3,8 @@ import { Router } from '@angular/router'; import { Subject, debounceTime } from 'rxjs'; +import { OptionFeed } from '@customTypes/option.type'; + import { AuthService } from '@services/auth.service'; import { UserService } from '@services/user.service'; @@ -18,7 +20,7 @@ export class NewsContainerComponent implements OnInit { @Input() feeds: Feed[] = []; @Input() recentFeed: Feed; @Output() moreItems: EventEmitter = new EventEmitter(); - private saveFeedSub: Subject = new Subject(); + private saveFeedSub: Subject<{id: string, option: OptionFeed}> = new Subject(); constructor( private router: Router, @@ -26,8 +28,8 @@ export class NewsContainerComponent implements OnInit { private userService: UserService, ) { this.saveFeedSub.pipe( - debounceTime(250)) - .subscribe((idFeed) => this.updatePreferences(idFeed) + debounceTime(300)) + .subscribe(({id, option}) => this.updatePreferences(id, option) ); } @@ -39,30 +41,38 @@ export class NewsContainerComponent implements OnInit { this.router.navigate([`/feed/${id}`]); } - saveFeed(id: string) { + modifyPreference(id: string, option: OptionFeed): void { if(!this.isAuthenticated) { return this.authService.showModalAuth('init'); } - this.saveFeedSub.next(id); + this.saveFeedSub.next({id, option}); } - updatePreferences(idFeed: string): void { - this.userService.modifyPreferences(idFeed, 'saved').subscribe(() => { + updatePreferences(idFeed: string, option: OptionFeed): void { + this.userService.modifyPreferences(idFeed, option).subscribe(() => { this.feeds.map(feed => { - if(feed._id === idFeed) { + if(option === 'saved' && feed._id === idFeed) { feed.inUser = !feed.inUser; } + if(option === 'liked' && feed._id === idFeed) { + feed.liked = !feed.liked; + feed.liked ? feed.likes++ : feed.likes--; + } }); }); } - changeStyle(element: HTMLElement, change: boolean): void { - if(change) element.classList.add('bxs-bookmark'); - else element.classList.remove('bxs-bookmark'); + changeStyle(element: HTMLElement, strClass: string, change: boolean): void { + if(change) { + element.classList.add(strClass); + element.style.transition = 'all 0.5s'; + } + else { + element.classList.remove(strClass); + } } onScroll(): void { this.moreItems.emit(true); } - } diff --git a/src/app/shared/search-input/search-input.component.css b/src/app/shared/search-input/search-input.component.css index f9e45f5..2ecc8e5 100644 --- a/src/app/shared/search-input/search-input.component.css +++ b/src/app/shared/search-input/search-input.component.css @@ -4,16 +4,15 @@ input.icon { background: var(--bg-color-card); - border: var(--border-input); + border: var(--border); border-radius: 30px; height: 45px; width: 100%; min-width: 0; - padding: 10px 5px 10px 50px; + padding: 10px 20px 10px 50px; color: var(--font-color-primary); font-size: 16px; - transition: 0.2s; - box-shadow: var(--box-shadow); + transition: 0.25s ease; } input.icon ~ i { @@ -27,3 +26,4 @@ input.icon ~ i { input.icon:focus ~ i { color: var(--primary-color); } + diff --git a/src/app/shared/skeletons/card-new/card-new.component.css b/src/app/shared/skeletons/card-new/card-new.component.css index 7d31aa6..729cb77 100644 --- a/src/app/shared/skeletons/card-new/card-new.component.css +++ b/src/app/shared/skeletons/card-new/card-new.component.css @@ -7,9 +7,9 @@ min-height: 10rem; height: 13rem; max-height: 13rem; - padding: 1rem 0.5rem; - margin: 0 0 1rem; + padding: 1rem; gap: 10px; + flex-direction: row-reverse; } .card-new .image { @@ -17,7 +17,7 @@ min-width: auto; height: 12rem; width: 12rem; - border-radius: 50%; + border-radius: 0.6rem } .card-new .content { @@ -39,7 +39,7 @@ .line { height: 30px; border-radius: 8px; - width: 100%; + width: 50%; } .line-1 { @@ -47,7 +47,7 @@ } .line-2 { - width: 70% !important; + width: 60% !important; } @media (max-width: 480px) { @@ -59,11 +59,8 @@ width: 95%; } - .line-1 { - width: 100% !important; - } .line-2 { - width: 78% !important; + width: 68% !important; } } diff --git a/src/app/shared/skeletons/card-websites-a/card-websites-a.component.css b/src/app/shared/skeletons/card-websites-a/card-websites-a.component.css index b21a9d3..5e083b9 100644 --- a/src/app/shared/skeletons/card-websites-a/card-websites-a.component.css +++ b/src/app/shared/skeletons/card-websites-a/card-websites-a.component.css @@ -14,7 +14,6 @@ gap: 1rem; opacity: 1; position: fixed; - transform: translate(0, 78px); } .card-website .item { diff --git a/src/styles.css b/src/styles.css index 4e3a71e..7bd9a58 100644 --- a/src/styles.css +++ b/src/styles.css @@ -25,7 +25,7 @@ body.dark { --bg-color: #000; --bg-color-card: #16181c; --bg-color-card-2: #000; - --bg-color-secondary: #e7e9ea; + --bg-color-secondary: #040a0d; --font-color-primary: #e7e9ea; --box-shadow: none; --bg-hover: rgb(231, 233, 234, 0.1); @@ -34,15 +34,16 @@ body.dark { --bg-skeleton-2: #2e2c2c; --text-shadow-color: #000000; --bg-blur: hsla(0, 0%, 10%, 0.6); - --border-input: 1px solid #333639; + --border: 1px solid #3e3e3e; + --separator-color: #3e3e3e; } :root { --primary-color: #0098fa; --secondary-color: #e66d9b; - --bg-color: #f4faff; - --bg-color-card: #ffffff; - --bg-color-card-2: #ffffff; + --bg-color: #fafafa; + --bg-color-card: #fafafa; + --bg-color-card-2: #fafafa; --bg-color-scroll: #a5a5a5; --bg-color-secondary: #262626; --bg-button-follow: transparent; @@ -54,7 +55,8 @@ body.dark { --bg-skeleton-2: #cdcdcd; --text-shadow-color: #e6e6e6; --bg-blur: hsla(0, 0%, 100%, 0.8); - --border-input: none; + --border: 1px solid #c1c1c1; + --separator-color: #c1c1c1; } ::-webkit-scrollbar { @@ -81,11 +83,10 @@ body.dark { } .card { - margin: 0.5rem 0; background: var(--bg-color-card); color: var(--font-color-primary); border-radius: 1rem; - box-shadow: var(--box-shadow); + border: var(--border); } .btn { @@ -235,11 +236,11 @@ section > .title-wrapper { width: 100%; height: auto; min-height: 70px; - padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; background: var(--bg-blur); + padding: 0 1rem; } .title-wrapper > span.title-section { @@ -270,9 +271,6 @@ section > .title-wrapper { transform: rotate(135deg); } -.news-container { - margin: 0 1rem; -} @supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) { section > .title-wrapper { diff --git a/tsconfig.json b/tsconfig.json index a7a805e..b9fd10b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,6 +33,7 @@ "@guards/*": [ "app/core/guards/*" ], "@constants/*": [ "app/core/constants/*" ], "@mocks/*": [ "app/core/mocks/*" ], + "@customTypes/*": [ "app/core/types/*" ], } }, "angularCompilerOptions": {
- {{ feed.pubDate | date: 'dd/MM/yyyy, h:mm a' }} • by - {{ feed.website.name }} -
{{ feed.pubDate | date: 'dd-MM-yyyy' }}
•
{{ 10 }} min