diff --git a/.env.example b/.env.example index e9f46fa..f726dee 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,4 @@ -VITE_APP_RELAY=wss://relay.degmods.com \ No newline at end of file +# This relay will be used to publish/retrieve events along with other relays (user's relays, admin relays) +VITE_APP_RELAY=wss://relay.degmods.com +# A comma separated list of npubs, Relay list will be extracted for these npubs and this relay list will be used to publish event +VITE_ADMIN_NPUBS= \ No newline at end of file diff --git a/index.html b/index.html index 6525419..65e172c 100644 --- a/index.html +++ b/index.html @@ -4,13 +4,13 @@ - + - + - + + + - DEG Mods - Liberating Game Mods diff --git a/package-lock.json b/package-lock.json index 0a80398..7f51552 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,9 @@ "dependencies": { "@nostr-dev-kit/ndk": "2.8.2", "@reduxjs/toolkit": "2.2.6", + "date-fns": "3.6.0", + "dompurify": "3.1.6", + "file-saver": "2.0.5", "lodash": "4.17.21", "nostr-login": "1.5.2", "nostr-tools": "2.7.1", @@ -24,6 +27,8 @@ "uuid": "10.0.0" }, "devDependencies": { + "@types/dompurify": "3.0.5", + "@types/file-saver": "2.0.7", "@types/lodash": "4.17.7", "@types/papaparse": "5.3.14", "@types/react": "^18.3.3", @@ -1538,12 +1543,27 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/dompurify": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz", + "integrity": "sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==", + "dev": true, + "dependencies": { + "@types/trusted-types": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "node_modules/@types/file-saver": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz", + "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==", + "dev": true + }, "node_modules/@types/lodash": { "version": "4.17.7", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", @@ -1610,6 +1630,12 @@ "@types/react": "*" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "dev": true + }, "node_modules/@types/use-sync-external-store": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz", @@ -2213,6 +2239,15 @@ "node": ">= 12" } }, + "node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/debug": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", @@ -2319,6 +2354,11 @@ "node": ">=6.0.0" } }, + "node_modules/dompurify": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz", + "integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==" + }, "node_modules/electron-to-chromium": { "version": "1.4.823", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.823.tgz", @@ -2854,6 +2894,11 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", diff --git a/package.json b/package.json index 54f4395..2f2f2b6 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,9 @@ "dependencies": { "@nostr-dev-kit/ndk": "2.8.2", "@reduxjs/toolkit": "2.2.6", + "date-fns": "3.6.0", + "dompurify": "3.1.6", + "file-saver": "2.0.5", "lodash": "4.17.21", "nostr-login": "1.5.2", "nostr-tools": "2.7.1", @@ -26,6 +29,8 @@ "uuid": "10.0.0" }, "devDependencies": { + "@types/dompurify": "3.0.5", + "@types/file-saver": "2.0.7", "@types/lodash": "4.17.7", "@types/papaparse": "5.3.14", "@types/react": "^18.3.3", diff --git a/public/assets/fonts/fa-brands-400.eot b/public/assets/fonts/fa-brands-400.eot new file mode 100644 index 0000000..baf4057 Binary files /dev/null and b/public/assets/fonts/fa-brands-400.eot differ diff --git a/public/assets/fonts/fa-brands-400.svg b/public/assets/fonts/fa-brands-400.svg new file mode 100644 index 0000000..843c1c7 --- /dev/null +++ b/public/assets/fonts/fa-brands-400.svg @@ -0,0 +1,3535 @@ + + + + + +Created by FontForge 20190801 at Tue Dec 10 16:09:21 2019 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/fonts/fa-brands-400.ttf b/public/assets/fonts/fa-brands-400.ttf new file mode 100644 index 0000000..9916328 Binary files /dev/null and b/public/assets/fonts/fa-brands-400.ttf differ diff --git a/public/assets/fonts/fa-brands-400.woff b/public/assets/fonts/fa-brands-400.woff new file mode 100644 index 0000000..f9e3bcd Binary files /dev/null and b/public/assets/fonts/fa-brands-400.woff differ diff --git a/public/assets/fonts/fa-brands-400.woff2 b/public/assets/fonts/fa-brands-400.woff2 new file mode 100644 index 0000000..51c07ae Binary files /dev/null and b/public/assets/fonts/fa-brands-400.woff2 differ diff --git a/public/assets/fonts/fa-regular-400.eot b/public/assets/fonts/fa-regular-400.eot new file mode 100644 index 0000000..04e25cb Binary files /dev/null and b/public/assets/fonts/fa-regular-400.eot differ diff --git a/public/assets/fonts/fa-regular-400.svg b/public/assets/fonts/fa-regular-400.svg new file mode 100644 index 0000000..f1f7e6c --- /dev/null +++ b/public/assets/fonts/fa-regular-400.svg @@ -0,0 +1,803 @@ + + + + + +Created by FontForge 20190801 at Tue Dec 10 16:09:21 2019 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/fonts/fa-regular-400.ttf b/public/assets/fonts/fa-regular-400.ttf new file mode 100644 index 0000000..9c6249c Binary files /dev/null and b/public/assets/fonts/fa-regular-400.ttf differ diff --git a/public/assets/fonts/fa-regular-400.woff b/public/assets/fonts/fa-regular-400.woff new file mode 100644 index 0000000..2873e43 Binary files /dev/null and b/public/assets/fonts/fa-regular-400.woff differ diff --git a/public/assets/fonts/fa-regular-400.woff2 b/public/assets/fonts/fa-regular-400.woff2 new file mode 100644 index 0000000..a34bd65 Binary files /dev/null and b/public/assets/fonts/fa-regular-400.woff2 differ diff --git a/public/assets/fonts/fa-solid-900.eot b/public/assets/fonts/fa-solid-900.eot new file mode 100644 index 0000000..39716a7 Binary files /dev/null and b/public/assets/fonts/fa-solid-900.eot differ diff --git a/public/assets/fonts/fa-solid-900.svg b/public/assets/fonts/fa-solid-900.svg new file mode 100644 index 0000000..cfd0e2f --- /dev/null +++ b/public/assets/fonts/fa-solid-900.svg @@ -0,0 +1,4700 @@ + + + + + +Created by FontForge 20190801 at Tue Dec 10 16:09:21 2019 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/fonts/fa-solid-900.ttf b/public/assets/fonts/fa-solid-900.ttf new file mode 100644 index 0000000..ac4baa2 Binary files /dev/null and b/public/assets/fonts/fa-solid-900.ttf differ diff --git a/public/assets/fonts/fa-solid-900.woff b/public/assets/fonts/fa-solid-900.woff new file mode 100644 index 0000000..23002f8 Binary files /dev/null and b/public/assets/fonts/fa-solid-900.woff differ diff --git a/public/assets/fonts/fa-solid-900.woff2 b/public/assets/fonts/fa-solid-900.woff2 new file mode 100644 index 0000000..b37f209 Binary files /dev/null and b/public/assets/fonts/fa-solid-900.woff2 differ diff --git a/public/assets/fonts/fontawesome-all.min.css b/public/assets/fonts/fontawesome-all.min.css new file mode 100644 index 0000000..27e7ddd --- /dev/null +++ b/public/assets/fonts/fontawesome-all.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.12.0 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-bahai:before{content:"\f666"}.fa-balance-scale:before{content:"\f24e"}.fa-balance-scale-left:before{content:"\f515"}.fa-balance-scale-right:before{content:"\f516"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-biking:before{content:"\f84a"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buy-n-large:before{content:"\f8a6"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caravan:before{content:"\f8ff"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-alt:before{content:"\f422"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-cotton-bureau:before{content:"\f89e"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-alt:before{content:"\f424"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fan:before{content:"\f863"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-firefox-browser:before{content:"\f907"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-handshake:before{content:"\f2b5"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-cowboy:before{content:"\f8c0"}.fa-hat-cowboy-side:before{content:"\f8c1"}.fa-hat-wizard:before{content:"\f6e8"}.fa-hdd:before{content:"\f0a0"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-ideal:before{content:"\f913"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-mdb:before{content:"\f8ca"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microblog:before{content:"\f91a"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse:before{content:"\f8cc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-orcid:before{content:"\f8d2"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-square-alt:before{content:"\f87b"}.fa-phone-volume:before{content:"\f2a0"}.fa-photo-video:before{content:"\f87c"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-square:before{content:"\f91e"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-record-vinyl:before{content:"\f8d9"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-remove-format:before{content:"\f87d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-down-alt:before{content:"\f884"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-amount-up-alt:before{content:"\f885"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swift:before{content:"\f8e1"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-trailer:before{content:"\f941"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbraco:before{content:"\f8e8"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-unity:before{content:"\f949"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:normal;font-display:auto;src:url(../fonts/fa-brands-400.eot);src:url(../fonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../fonts/fa-brands-400.woff2) format("woff2"),url(../fonts/fa-brands-400.woff) format("woff"),url(../fonts/fa-brands-400.ttf) format("truetype"),url(../fonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:auto;src:url(../fonts/fa-regular-400.eot);src:url(../fonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../fonts/fa-regular-400.woff2) format("woff2"),url(../fonts/fa-regular-400.woff) format("woff"),url(../fonts/fa-regular-400.ttf) format("truetype"),url(../fonts/fa-regular-400.svg#fontawesome) format("svg")}.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:auto;src:url(../fonts/fa-solid-900.eot);src:url(../fonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../fonts/fa-solid-900.woff2) format("woff2"),url(../fonts/fa-solid-900.woff) format("woff"),url(../fonts/fa-solid-900.ttf) format("truetype"),url(../fonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900} \ No newline at end of file diff --git a/src/components/LoadingSpinner/index.tsx b/src/components/LoadingSpinner/index.tsx new file mode 100644 index 0000000..9f22262 --- /dev/null +++ b/src/components/LoadingSpinner/index.tsx @@ -0,0 +1,18 @@ +import styles from '../../styles/loadingSpinner.module.scss' + +interface Props { + desc: string +} + +export const LoadingSpinner = (props: Props) => { + const { desc } = props + + return ( +
+
+
+ {desc && {desc}} +
+
+ ) +} diff --git a/src/components/ModCard.tsx b/src/components/ModCard.tsx index eb2f17c..68cc1fb 100644 --- a/src/components/ModCard.tsx +++ b/src/components/ModCard.tsx @@ -1,12 +1,20 @@ import '../styles/cardMod.css' type ModCardProps = { + title: string + summary: string backgroundLink: string + handleClick: () => void } -export const ModCard = ({ backgroundLink }: ModCardProps) => { +export const ModCard = ({ + title, + summary, + backgroundLink, + handleClick +}: ModCardProps) => { return ( -
+
{ }} >
-

- This is a mod title for an awesome game that will make everyone - happy! The happiest! -

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec - odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla - quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent - mauris. Fusce nec tellus sed augue semper porta. Mauris massa. - Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad - litora torquent per conubia nostra, per inceptos himenaeos. - Curabitur sodales ligula in libero. -
-
-

+

{title}

+

{summary}

diff --git a/src/components/ModForm.tsx b/src/components/ModForm.tsx index bb9d81f..a88f88b 100644 --- a/src/components/ModForm.tsx +++ b/src/components/ModForm.tsx @@ -1,13 +1,21 @@ import _ from 'lodash' -import { Event, kinds, UnsignedEvent } from 'nostr-tools' +import { Event, kinds, nip19, UnsignedEvent } from 'nostr-tools' import Papa from 'papaparse' -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import React, { + Fragment, + useCallback, + useEffect, + useMemo, + useRef, + useState +} from 'react' import { toast } from 'react-toastify' import { FixedSizeList as List } from 'react-window' import { v4 as uuidv4 } from 'uuid' import { useAppSelector } from '../hooks' import '../styles/styles.css' import { + initializeFormState, isReachable, isValidImageUrl, isValidUrl, @@ -17,27 +25,11 @@ import { } from '../utils' import { CheckboxField, InputError, InputField } from './Inputs' import { RelayController } from '../controllers' - -interface DownloadUrl { - url: string - hash: string - signatureKey: string - malwareScanLink: string - modVersion: string - customNote: string -} - -interface FormState { - game: string - title: string - body: string - featuredImageUrl: string - summary: string - nsfw: boolean - screenshotsUrls: string[] - tags: string - downloadUrls: DownloadUrl[] -} +import { useNavigate } from 'react-router-dom' +import { getModsInnerPageRoute } from '../routes' +import { DownloadUrl, ModFormState, ModDetails } from '../types' +import { LoadingSpinner } from './LoadingSpinner' +import { T_TAG_VALUE } from '../constants' interface FormErrors { game?: string @@ -58,31 +50,20 @@ interface GameOption { let processedCSV = false -export const ModForm = () => { +type ModFormProps = { + existingModData?: ModDetails +} + +export const ModForm = ({ existingModData }: ModFormProps) => { + const navigate = useNavigate() const userState = useAppSelector((state) => state.user) const [isPublishing, setIsPublishing] = useState(false) const [gameOptions, setGameOptions] = useState([]) - const [formState, setFormState] = useState({ - game: '', - title: '', - body: '', - featuredImageUrl: '', - summary: '', - nsfw: false, - screenshotsUrls: [''], - tags: '', - downloadUrls: [ - { - url: '', - hash: '', - signatureKey: '', - malwareScanLink: '', - modVersion: '', - customNote: '' - } - ] - }) + const [formState, setFormState] = useState( + initializeFormState(existingModData) + ) + const [formErrors, setFormErrors] = useState({}) useEffect(() => { @@ -229,9 +210,19 @@ export const ModForm = () => { pubkey: hexPubkey, content: formState.body, tags: [ - ['d', uuid], - ['t', window.location.host], - ['published_at', currentTimeStamp.toString()], + ['d', formState.dTag || uuid], + [ + 'a', + formState.aTag || `${kinds.ClassifiedListing}:${hexPubkey}:${uuid}` + ], + ['r', formState.rTag], + ['t', T_TAG_VALUE], + [ + 'published_at', + existingModData + ? existingModData.published_at.toString() + : currentTimeStamp.toString() + ], ['game', formState.game], ['title', formState.title], ['featuredImageUrl', formState.featuredImageUrl], @@ -250,6 +241,7 @@ export const ModForm = () => { const signedEvent = await window.nostr ?.signEvent(unsignedEvent) + .then((event) => event as Event) .catch((err) => { toast.error('Failed to sign the event!') log(true, LogType.Error, 'Failed to sign the event!', err) @@ -265,14 +257,6 @@ export const ModForm = () => { signedEvent as Event ) - console.log('publishedOnRelays :>> ', publishedOnRelays) - - if (!publishedOnRelays) { - toast.error('Failed to publish event!') - setIsPublishing(false) - return - } - // Handle cases where publishing failed or succeeded if (publishedOnRelays.length === 0) { toast.error('Failed to publish event on any relay') @@ -282,6 +266,15 @@ export const ModForm = () => { '\n' )}` ) + + const nevent = nip19.neventEncode({ + id: signedEvent.id, + author: signedEvent.pubkey, + kind: signedEvent.kind, + relays: publishedOnRelays + }) + + navigate(getModsInnerPageRoute(nevent)) } setIsPublishing(false) @@ -363,6 +356,7 @@ export const ModForm = () => { return ( <> + {isPublishing && } { We recommend to upload images to https://nostr.build/

{formState.screenshotsUrls.map((url, index) => ( - <> + { formErrors.screenshotsUrls[index] && ( )} - + ))} {formState.screenshotsUrls.length === 0 && formErrors.screenshotsUrls && @@ -493,9 +486,8 @@ export const ModForm = () => {

{formState.downloadUrls.map((download, index) => ( - <> + { {formErrors.downloadUrls && formErrors.downloadUrls[index] && ( )} - + ))} {formState.downloadUrls.length === 0 && diff --git a/src/components/ProfileSection.tsx b/src/components/ProfileSection.tsx index 96e055a..4f5c3cb 100644 --- a/src/components/ProfileSection.tsx +++ b/src/components/ProfileSection.tsx @@ -20,7 +20,7 @@ export const ProfileSection = () => { className='IBMSMSMSSS_Author_Top_PP' style={{ background: - "url('assets/img/media-cache%20(4).png') center / cover no-repeat" + "url('/assets/img/media-cache%20(4).png') center / cover no-repeat" }} >
@@ -219,6 +219,6 @@ const posts: Post[] = [ name: 'Freakoverse', link: `feed-note.html`, content: `This is good.`, - imageUrl: 'assets/img/media-cache%20(1).jpg' + imageUrl: '/assets/img/media-cache%20(1).jpg' } ] diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..79661bc --- /dev/null +++ b/src/constants.ts @@ -0,0 +1 @@ +export const T_TAG_VALUE = 'GameMod' diff --git a/src/controllers/metadata.ts b/src/controllers/metadata.ts index c1cac3a..ad8609d 100644 --- a/src/controllers/metadata.ts +++ b/src/controllers/metadata.ts @@ -1,19 +1,55 @@ -import NDK, { NDKRelayList, NDKUser } from '@nostr-dev-kit/ndk' +import NDK, { NDKList, NDKRelayList, NDKUser } from '@nostr-dev-kit/ndk' import { UserProfile } from '../types/user' -import { hexToNpub } from '../utils' +import { hexToNpub, log, LogType, npubToHex } from '../utils' +import { kinds } from 'nostr-tools' +import { MuteLists } from '../types' /** * Singleton class to manage metadata operations using NDK. */ export class MetadataController { private static instance: MetadataController - private profileNdk: NDK + private ndk: NDK + public adminNpubs: string[] + public adminRelays = new Set() private constructor() { - this.profileNdk = new NDK({ - explicitRelayUrls: ['wss://user.kindpag.es', 'wss://purplepag.es'] + this.ndk = new NDK({ + explicitRelayUrls: [ + 'wss://user.kindpag.es', + 'wss://purplepag.es', + 'wss://relay.damus.io/' + ] }) - this.profileNdk.connect() + this.ndk.connect() + + this.adminNpubs = import.meta.env.VITE_ADMIN_NPUBS.split(',') + } + + private setAdminRelays = async () => { + const promises = this.adminNpubs.map((npub) => { + const hexKey = npubToHex(npub) + if (!hexKey) return null + + return NDKRelayList.forUser(hexKey, this.ndk) + .then((ndkRelayList) => { + if (ndkRelayList) { + ndkRelayList.writeRelayUrls.forEach((url) => + this.adminRelays.add(url) + ) + } + }) + .catch((err) => { + log( + true, + LogType.Error, + `❌ Error occurred in getting the instance of NDKRelayList for npub: ${npub}`, + err + ) + }) + }) + + await Promise.allSettled(promises) } /** @@ -21,9 +57,11 @@ export class MetadataController { * * @returns The singleton instance of MetadataController. */ - public static getInstance(): MetadataController { + public static async getInstance(): Promise { if (!MetadataController.instance) { MetadataController.instance = new MetadataController() + + MetadataController.instance.setAdminRelays() } return MetadataController.instance } @@ -37,13 +75,13 @@ export class MetadataController { public findMetadata = async (pubkey: string): Promise => { const npub = hexToNpub(pubkey) const user = new NDKUser({ npub }) - user.ndk = this.profileNdk + user.ndk = this.ndk return await user.fetchProfile() } public findWriteRelays = async (hexKey: string) => { - const ndkRelayList = await NDKRelayList.forUser(hexKey, this.profileNdk) + const ndkRelayList = await NDKRelayList.forUser(hexKey, this.ndk) if (!ndkRelayList) { throw new Error(`Couldn't found user's relay list`) @@ -51,4 +89,39 @@ export class MetadataController { return ndkRelayList.writeRelayUrls } + + public getAdminsMuteLists = async (): Promise => { + // Create a Set to collect all unique muted authors + + const mutedAuthors = new Set() + + // Create an array of promises to fetch mute lists for each npub + const promises = this.adminNpubs.map(async (npub) => { + const hexKey = npubToHex(npub) + if (!hexKey) return + + const muteListEvent = await this.ndk.fetchEvent({ + kinds: [kinds.Mutelist], + authors: [hexKey] + }) + + if (muteListEvent) { + const list = NDKList.from(muteListEvent) + + list.items.forEach((item) => { + // Add muted authors to the Set directly + if (item[0] === 'p') { + mutedAuthors.add(item[1]) + } + }) + } + }) + + await Promise.allSettled(promises) + + return { + authors: Array.from(mutedAuthors), + eventIds: [] + } + } } diff --git a/src/controllers/relay.ts b/src/controllers/relay.ts index 7eb668e..18b42b8 100644 --- a/src/controllers/relay.ts +++ b/src/controllers/relay.ts @@ -1,7 +1,6 @@ -import { Relay, Event } from 'nostr-tools' -import { log, LogType, timeout } from '../utils' +import { Event, Filter, Relay } from 'nostr-tools' +import { log, LogType, normalizeWebSocketURL, timeout } from '../utils' import { MetadataController } from './metadata' -import _ from 'lodash' /** * Singleton class to manage relay operations. @@ -15,7 +14,8 @@ export class RelayController { private connectRelay = async (relayUrl: string) => { const relay = this.connectedRelays.find( - (relay) => _.trimEnd(relay.url, '/') === _.trimEnd(relayUrl, '/') + (relay) => + normalizeWebSocketURL(relay.url) === normalizeWebSocketURL(relayUrl) ) if (relay) { // already connected, skip @@ -51,38 +51,62 @@ export class RelayController { return RelayController.instance } - publish = async (event: Event) => { + /** + * Publishes an event to multiple relays. + * + * This method connects to the application relay and a set of write relays + * obtained from the `MetadataController`. It then publishes the event to + * all connected relays and returns a list of relays where the event was successfully published. + * + * @param event - The event to be published. + * @returns A promise that resolves to an array of URLs of relays where the event was published, + * or an empty array if no relays were connected or the event could not be published. + */ + publish = async (event: Event): Promise => { + // Connect to the application relay specified by environment variable const appRelayPromise = this.connectRelay(import.meta.env.VITE_APP_RELAY) // todo: window.nostr.getRelays() is not implemented yet in nostr-login, implement the logic once its done - const writeRelaysPromise = MetadataController.getInstance().findWriteRelays( - event.pubkey - ) + const metadataController = await MetadataController.getInstance() - log(this.debug, LogType.Info, `Finding user's write relays`) + // Retrieve the list of write relays for the event's public key + // Use a timeout to handle cases where retrieving write relays takes too long + const writeRelaysPromise = metadataController.findWriteRelays(event.pubkey) + + log(this.debug, LogType.Info, `ℹ Finding user's write relays`) + + // Use Promise.race to either get the write relay URLs or timeout const writeRelayUrls = await Promise.race([ writeRelaysPromise, - timeout() + timeout() // This is a custom timeout function that rejects the promise after a specified time ]).catch((err) => { log(this.debug, LogType.Error, err) - return [] as string[] + return [] as string[] // Return an empty array if an error occurs }) + // push admin relay urls obtained from metadata controller to writeRelayUrls list + metadataController.adminRelays.forEach((url) => { + writeRelayUrls.push(url) + }) + + // Connect to all write relays obtained from MetadataController const relayPromises = writeRelayUrls.map((relayUrl) => this.connectRelay(relayUrl) ) + // Wait for all relay connections to settle (either fulfilled or rejected) await Promise.allSettled([appRelayPromise, ...relayPromises]) + // Check if any relays are connected; if not, log an error and return null if (this.connectedRelays.length === 0) { log(this.debug, LogType.Error, 'No relay is connected!') - - return null + return [] } - const publishedOnRelays: string[] = [] + const publishedOnRelays: string[] = [] // List to track which relays successfully published the event + // Create a promise for publishing the event to each connected relay const publishPromises = this.connectedRelays.map((relay) => { log( this.debug, @@ -91,7 +115,10 @@ export class RelayController { event ) - return Promise.race([relay.publish(event), timeout(30000)]) + return Promise.race([ + relay.publish(event), // Publish the event to the relay + timeout(30000) // Set a timeout to handle cases where publishing takes too long + ]) .then((res) => { log( this.debug, @@ -99,8 +126,7 @@ export class RelayController { `⬆️ nostr (${relay.url}): Publish result:`, res ) - - publishedOnRelays.push(relay.url) + publishedOnRelays.push(relay.url) // Add the relay URL to the list of successfully published relays }) .catch((err) => { log( @@ -112,10 +138,102 @@ export class RelayController { }) }) + // Wait for all publish operations to complete (either fulfilled or rejected) await Promise.allSettled(publishPromises) - console.log('publishedOnRelays :>> ', publishedOnRelays) - + // Return the list of relay URLs where the event was published return publishedOnRelays } + + /** + * Asynchronously retrieves multiple event from a set of relays based on a provided filter. + * If no relays are specified, it defaults to using connected relays. + * + * @param {Filter} filter - The filter criteria to find the event. + * @param {string[]} [relays] - An optional array of relay URLs to search for the event. + * @returns {Promise} - Returns a promise that resolves to the found event or null if not found. + */ + fetchEvents = async ( + filter: Filter, + relays: string[] = [] + ): Promise => { + // add app relay to relays array + relays.push(import.meta.env.VITE_APP_RELAY) + + const metadataController = await MetadataController.getInstance() + // add admin relays to relays array + metadataController.adminRelays.forEach((url) => { + relays.push(url) + }) + + // Connect to all specified relays + const relayPromises = relays.map((relayUrl) => this.connectRelay(relayUrl)) + await Promise.allSettled(relayPromises) + + // Check if any relays are connected + if (this.connectedRelays.length === 0) { + log(this.debug, LogType.Error, 'No relay is connected to fetch events!') + throw new Error('No relay is connected to fetch events!') + } + + const events: Event[] = [] + const eventIds = new Set() // To keep track of event IDs and avoid duplicates + + // Create a promise for each relay subscription + const subPromises = this.connectedRelays.map((relay) => { + return new Promise((resolve) => { + // Subscribe to the relay with the specified filter + const sub = relay.subscribe([filter], { + // Handle incoming events + onevent: (e) => { + // Add the event to the array if it's not a duplicate + if (!eventIds.has(e.id)) { + eventIds.add(e.id) // Record the event ID + events.push(e) // Add the event to the array + } + }, + // Handle the End-Of-Stream (EOSE) message + oneose: () => { + sub.close() // Close the subscription + resolve() // Resolve the promise when EOSE is received + } + }) + }) + }) + + // Wait for all subscriptions to complete + await Promise.allSettled(subPromises) + + // It is possible that different relays will send different events and events array may contain more events then specified limit in filter + // To fix this issue we'll first sort these events and then return only limited events + if (filter.limit) { + // Sort events by creation date in descending order + events.sort((a, b) => b.created_at - a.created_at) + + return events.slice(0, filter.limit) + } + + return events + } + + /** + * Asynchronously retrieves an event from a set of relays based on a provided filter. + * If no relays are specified, it defaults to using connected relays. + * + * @param {Filter} filter - The filter criteria to find the event. + * @param {string[]} [relays] - An optional array of relay URLs to search for the event. + * @returns {Promise} - Returns a promise that resolves to the found event or null if not found. + */ + fetchEvent = async ( + filter: Filter, + relays: string[] = [] + ): Promise => { + const events = await this.fetchEvents(filter, relays) + + // Sort events by creation date in descending order + events.sort((a, b) => b.created_at - a.created_at) + + // Return the most recent event, or null if no events were received + return events[0] || null + } } diff --git a/src/hooks/index.ts b/src/hooks/index.ts index c7c7b90..7d4ee84 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1 +1,2 @@ export * from './redux' +export * from './useDidMount' diff --git a/src/hooks/useDidMount.ts b/src/hooks/useDidMount.ts new file mode 100644 index 0000000..5bac96a --- /dev/null +++ b/src/hooks/useDidMount.ts @@ -0,0 +1,12 @@ +import { useRef, useEffect } from 'react' + +export const useDidMount = (callback: () => void) => { + const didMount = useRef(false) + + useEffect(() => { + if (callback && !didMount.current) { + didMount.current = true + callback() + } + }) +} diff --git a/src/layout/header.tsx b/src/layout/header.tsx index 61a9187..84a65e4 100644 --- a/src/layout/header.tsx +++ b/src/layout/header.tsx @@ -11,6 +11,7 @@ import { useEffect } from 'react' import { useAppDispatch, useAppSelector } from '../hooks' import { setIsAuth, setUser } from '../store/reducers/user' import { MetadataController } from '../controllers' +import { npubToHex } from '../utils' export const Header = () => { const dispatch = useAppDispatch() @@ -28,11 +29,18 @@ export const Header = () => { } else { dispatch(setIsAuth(true)) dispatch(setUser({ npub })) - const metadataController = MetadataController.getInstance() - metadataController.findMetadata(npub).then((userProfile) => { - if (userProfile) { - dispatch(setUser(userProfile)) - } + MetadataController.getInstance().then((metadataController) => { + metadataController.findMetadata(npub).then((userProfile) => { + if (userProfile) { + dispatch( + setUser({ + npub, + pubkey: npubToHex(npub)!, + ...userProfile + }) + ) + } + }) }) } } @@ -57,7 +65,7 @@ export const Header = () => {
@@ -131,7 +139,7 @@ export const Header = () => { > Login
diff --git a/src/pages/about.tsx b/src/pages/about.tsx index 854c933..d85d3d9 100644 --- a/src/pages/about.tsx +++ b/src/pages/about.tsx @@ -216,7 +216,7 @@ export const AboutPage = () => {
diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 84c9ad2..71dbfd1 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -150,9 +150,21 @@ export const HomePage = () => {

Awesome Mods

- - - + + +
{

Latest Mods

- - - - + + + +
diff --git a/src/pages/innerMod.tsx b/src/pages/innerMod.tsx new file mode 100644 index 0000000..55e9ab1 --- /dev/null +++ b/src/pages/innerMod.tsx @@ -0,0 +1,917 @@ +import { formatDate } from 'date-fns' +import DOMPurify from 'dompurify' +import { Filter, nip19 } from 'nostr-tools' +import { useRef, useState } from 'react' +import { useNavigate, useParams } from 'react-router-dom' +import { toast } from 'react-toastify' +import { BlogCard } from '../components/BlogCard' +import { LoadingSpinner } from '../components/LoadingSpinner' +import { ProfileSection } from '../components/ProfileSection' +import { RelayController } from '../controllers' +import { useAppSelector, useDidMount } from '../hooks' +import '../styles/comments.css' +import '../styles/downloads.css' +import '../styles/innerPage.css' +import '../styles/post.css' +import '../styles/reactions.css' +import '../styles/styles.css' +import '../styles/tabs.css' +import '../styles/tags.css' +import '../styles/write.css' +import { ModDetails } from '../types' +import { + copyTextToClipboard, + extractModData, + getFilenameFromUrl, + log, + LogType +} from '../utils' + +import saveAs from 'file-saver' + +export const InnerModPage = () => { + const { nevent } = useParams() + const [modData, setModData] = useState() + const [isFetching, setIsFetching] = useState(true) + + useDidMount(async () => { + if (nevent) { + const decoded = nip19.decode<'nevent'>(nevent as `nevent1${string}`) + const eventId = decoded.data.id + const kind = decoded.data.kind + const author = decoded.data.author + const relays = decoded.data.relays || [] + + const filter: Filter = { + ids: [eventId] + } + + if (kind) filter.kinds = [kind] + + if (author) filter.authors = [author] + + RelayController.getInstance() + .fetchEvent(filter, relays) + .then((event) => { + if (event) { + const extracted = extractModData(event) + setModData(extracted) + } + }) + .catch((err) => { + log( + true, + LogType.Error, + 'An error occurred in fetching mod details from relays', + err + ) + toast.error('An error occurred in fetching mod details from relays') + }) + .finally(() => { + setIsFetching(false) + }) + } + }) + + const oldDownloadListRef = useRef(null) + + const handleViewOldLinks = () => { + if (oldDownloadListRef.current) { + // Toggle styles + if (oldDownloadListRef.current.style.height === '0px') { + // Enable styles + oldDownloadListRef.current.style.padding = '' + oldDownloadListRef.current.style.height = '' + oldDownloadListRef.current.style.border = '' + } else { + // Disable styles + oldDownloadListRef.current.style.padding = '0' + oldDownloadListRef.current.style.height = '0' + oldDownloadListRef.current.style.border = 'unset' + } + } + } + + if (isFetching) + return + + if (!modData) return null + + return ( +
+
+
+
+
+
+ + + + +
+
+
+

Mod Download

+ {modData.downloadUrls.length > 0 && ( +
+ +
+ )} + {modData.downloadUrls.length > 1 && ( + <> +
+ +
+
+ {modData.downloadUrls + .slice(1) + .map((download, index) => ( + + ))} +
+ + )} +
+
+
+
+

Creator's Blog Posts

+
+ + + +
+
+
+
+ +
+
+ +
+
+
+
+ ) +} + +type GameProps = { + game: string + author: string +} + +const Game = ({ game, author }: GameProps) => { + const navigate = useNavigate() + const userState = useAppSelector((state) => state.user) + + return ( +
+

+ Mod for:  + + {game} + +

+
+ +
+ {userState.isAuth && userState.user?.pubkey === author && ( + + navigate( + window.location.pathname.replace('mods-inner', 'edit-mod') + ) + } + > + + + + Edit + + )} + + { + copyTextToClipboard(window.location.href).then((isCopied) => { + if (isCopied) toast.success('Url copied to clipboard!') + }) + }} + > + + + + Copy URL + + + + + + Share + + + + + + Report + + + + + + Block Post + +
+
+
+ ) +} + +type BodyProps = { + featuredImageUrl: string + title: string + body: string + screenshotsUrls: string[] + tags: string[] +} + +const Body = ({ + featuredImageUrl, + title, + body, + screenshotsUrls, + tags +}: BodyProps) => { + const postBodyRef = useRef(null) + const viewFullPostBtnRef = useRef(null) + + const viewFullPost = () => { + if (postBodyRef.current && viewFullPostBtnRef.current) { + postBodyRef.current.style.maxHeight = 'unset' + postBodyRef.current.style.padding = 'unset' + viewFullPostBtnRef.current.style.display = 'none' + } + } + + return ( +
+
+
+
+

{title}

+
+
+
+
+

View

+
+
+
+ {screenshotsUrls.map((url, index) => ( + {`ScreenShot-${index}`} + ))} +
+
+ {tags.map((tag, index) => ( + + {tag} + + ))} +
+
+
+ ) +} + +const Interactions = () => { + return ( +
+
+ +
+
+ + + +
+

420

+
+
+
+
+ + + +
+

69k

+
+
+
+
+
+
+ + + +
+

4.2k

+
+
+
+
+
+
+ + + +
+

69

+
+
+
+
+
+
+ ) +} + +type PublishDetailsProps = { + published_at: number + edited_at: number + site: string +} + +const PublishDetails = ({ + published_at, + edited_at, + site +}: PublishDetailsProps) => { + return ( +
+
+
+ + + +

+ {formatDate( + (published_at !== -1 ? published_at : edited_at) * 1000, + 'dd/m/yyyy' + )} +

+
+
+ + + +

+ {formatDate(edited_at * 1000, 'dd/m/yyyy')} +

+
+ + + + +

{site}

+
+
+
+ ) +} + +type DownloadProps = { + url: string +} + +const Download = ({ url }: DownloadProps) => { + const handleDownload = () => { + // Get the filename from the URL + const filename = getFilenameFromUrl(url) + + saveAs(url, filename) + } + + return ( +
+
+ +
+
+

Ratings:

+
+ +
+
+
+
+
+ + + +
+

420

+
+
+
+ + + +
+

420

+
+
+
+ + + +
+

420

+
+
+
+
+
+
+
+ + + +
+

4,200

+
+
+
+ + + +
+

4,200

+
+
+
+ + + +
+

4,200

+
+
+
+
+
+
+
+ ) +} + +const Comments = () => { + return ( +
+

Comments

+
+
+
+ +
+ +
+
+ + +
+
+
+ +
+

+ Yo this article was insane to read! +

+
+
+
+
+ + + +

52

+
+
+
+
+
+ + + +

4

+
+
+
+
+
+ + + +

6

+
+
+
+
+
+ + + +

500K

+
+
+
+
+
+ + + +

12

+

Replies

+
+
+

Reply

+
+
+
+
+
+
+
+ ) +} diff --git a/src/pages/mods.tsx b/src/pages/mods.tsx index e4205ff..00cd090 100644 --- a/src/pages/mods.tsx +++ b/src/pages/mods.tsx @@ -1,186 +1,410 @@ +import { kinds, nip19 } from 'nostr-tools' +import React, { + Dispatch, + SetStateAction, + useCallback, + useEffect, + useMemo, + useState +} from 'react' +import { useNavigate } from 'react-router-dom' +import { LoadingSpinner } from '../components/LoadingSpinner' +import { ModCard } from '../components/ModCard' +import { MetadataController } from '../controllers' +import { useDidMount } from '../hooks' +import { getModsInnerPageRoute } from '../routes' import '../styles/filters.css' import '../styles/pagination.css' -import '../styles/styles.css' import '../styles/search.css' -import { ModCard } from '../components/ModCard' +import '../styles/styles.css' +import { ModDetails, MuteLists } from '../types' +import { fetchMods } from '../utils' + +enum SortBy { + Latest = 'Latest', + Oldest = 'Oldest', + Best_Rated = 'Best Rated', + Worst_Rated = 'Worst Rated' +} + +enum NSFWFilter { + Hide_NSFW = 'Hide NSFW', + Show_NSFW = 'Show NSFW', + Only_NSFW = 'Only NSFW' +} + +enum ModeratedFilter { + Moderated = 'Moderated', + Unmoderated = 'Unmoderated' +} + +interface FilterOptions { + sort: SortBy + nsfw: NSFWFilter + source: string + moderated: ModeratedFilter +} export const ModsPage = () => { + const navigate = useNavigate() + const [isFetching, setIsFetching] = useState(false) + const [mods, setMods] = useState([]) + const [filterOptions, setFilterOptions] = useState({ + sort: SortBy.Latest, + nsfw: NSFWFilter.Hide_NSFW, + source: window.location.host, + moderated: ModeratedFilter.Moderated + }) + const [muteLists, setMuteLists] = useState({ + authors: [], + eventIds: [] + }) + + const [page, setPage] = useState(1) + + useDidMount(async () => { + const metadataController = await MetadataController.getInstance() + metadataController.getAdminsMuteLists().then((lists) => { + setMuteLists(lists) + }) + }) + + useEffect(() => { + setIsFetching(true) + fetchMods(filterOptions.source) + .then((res) => { + setMods(res) + }) + .finally(() => { + setIsFetching(false) + }) + }, [filterOptions.source]) + + const handleNext = useCallback(() => { + setIsFetching(true) + + const until = + mods.length > 0 ? mods[mods.length - 1].edited_at - 1 : undefined + + fetchMods(filterOptions.source, until) + .then((res) => { + setMods(res) + setPage((prev) => prev + 1) + }) + .finally(() => { + setIsFetching(false) + }) + }, [filterOptions.source, mods]) + + const handlePrev = useCallback(() => { + setIsFetching(true) + + const since = mods.length > 0 ? mods[0].edited_at + 1 : undefined + + fetchMods(filterOptions.source, undefined, since) + .then((res) => { + setMods(res) + setPage((prev) => prev - 1) + }) + .finally(() => { + setIsFetching(false) + }) + }, [filterOptions.source, mods]) + + const filteredModList = useMemo(() => { + const nsfwFilter = (mods: ModDetails[]) => { + // Determine the filtering logic based on the NSFW filter option + switch (filterOptions.nsfw) { + case NSFWFilter.Hide_NSFW: + // If 'Hide_NSFW' is selected, filter out NSFW mods + return mods.filter((mod) => !mod.nsfw) + case NSFWFilter.Show_NSFW: + // If 'Show_NSFW' is selected, return all mods (no filtering) + return mods + case NSFWFilter.Only_NSFW: + // If 'Only_NSFW' is selected, filter to show only NSFW mods + return mods.filter((mod) => mod.nsfw) + } + } + + let filtered = nsfwFilter(mods) + + if (filterOptions.moderated === ModeratedFilter.Moderated) { + filtered = filtered.filter( + (mod) => + !muteLists.authors.includes(mod.author) && + !muteLists.eventIds.includes(mod.id) + ) + } + + if (filterOptions.sort === SortBy.Latest) { + filtered.sort((a, b) => b.edited_at - a.edited_at) + } else if (filterOptions.sort === SortBy.Oldest) { + filtered.sort((a, b) => a.edited_at - b.edited_at) + } + + return filtered + }, [ + filterOptions.sort, + filterOptions.moderated, + filterOptions.nsfw, + mods, + muteLists + ]) + return ( -
-
-
-
-
-
-

Mods

-
-
-
-
- - -
-
+ <> + {isFetching && } +
+
+
+ + + +
+
+ {filteredModList.map((mod) => ( + + navigate( + getModsInnerPageRoute( + nip19.neventEncode({ + id: mod.id, + author: mod.author, + kind: kinds.ClassifiedListing + }) + ) + ) + } + /> + ))}
-
- +
+
+ + ) +} -
-
- - - - - - - - -
-
- -
-
- ) +}) + +type FiltersProps = { + filterOptions: FilterOptions + setFilterOptions: Dispatch> } + +const Filters = React.memo( + ({ filterOptions, setFilterOptions }: FiltersProps) => { + return ( +
+
+
+
+ + +
+ {Object.values(SortBy).map((item, index) => ( +
+ setFilterOptions((prev) => ({ + ...prev, + sort: item + })) + } + > + {item} +
+ ))} +
+
+
+
+
+ +
+ {Object.values(ModeratedFilter).map((item, index) => ( +
+ setFilterOptions((prev) => ({ + ...prev, + moderated: item + })) + } + > + {item} +
+ ))} +
+
+
+
+
+ +
+ {Object.values(NSFWFilter).map((item, index) => ( +
+ setFilterOptions((prev) => ({ + ...prev, + nsfw: item + })) + } + > + {item} +
+ ))} +
+
+
+
+
+ +
+
+ setFilterOptions((prev) => ({ + ...prev, + source: window.location.host + })) + } + > + Show From: {window.location.host} +
+
+ setFilterOptions((prev) => ({ + ...prev, + source: 'Show All' + })) + } + > + Show All +
+
+
+
+
+
+ ) + } +) + +type PaginationProps = { + page: number + disabledNext: boolean + handlePrev: () => void + handleNext: () => void +} + +const Pagination = React.memo( + ({ page, disabledNext, handlePrev, handleNext }: PaginationProps) => { + return ( +
+
+
+ +
+ +
+ +
+
+
+ ) + } +) diff --git a/src/pages/settings.tsx b/src/pages/settings.tsx index 4cfbf8a..4b43de7 100644 --- a/src/pages/settings.tsx +++ b/src/pages/settings.tsx @@ -168,7 +168,7 @@ const ProfileSettings = () => {
diff --git a/src/pages/submitMod.tsx b/src/pages/submitMod.tsx index 3e4e55c..372b372 100644 --- a/src/pages/submitMod.tsx +++ b/src/pages/submitMod.tsx @@ -1,10 +1,67 @@ +import { useLocation, useParams } from 'react-router-dom' import { ModForm } from '../components/ModForm' import { ProfileSection } from '../components/ProfileSection' import '../styles/innerPage.css' import '../styles/styles.css' import '../styles/write.css' +import { Filter, nip19 } from 'nostr-tools' +import { RelayController } from '../controllers' +import { extractModData, log, LogType } from '../utils' +import { ModDetails } from '../types' +import { toast } from 'react-toastify' +import { useState } from 'react' +import { LoadingSpinner } from '../components/LoadingSpinner' +import { useDidMount } from '../hooks' export const SubmitModPage = () => { + const location = useLocation() + const { nevent } = useParams() + const [modData, setModData] = useState() + const [isFetching, setIsFetching] = useState(false) + + const title = location.pathname.startsWith('/edit-mod') + ? 'Edit Mod' + : 'Submit a mod' + + useDidMount(async () => { + if (nevent) { + const decoded = nip19.decode<'nevent'>(nevent as `nevent1${string}`) + const eventId = decoded.data.id + const kind = decoded.data.kind + const author = decoded.data.author + const relays = decoded.data.relays || [] + + const filter: Filter = { + ids: [eventId] + } + + if (kind) filter.kinds = [kind] + + if (author) filter.authors = [author] + + setIsFetching(true) + RelayController.getInstance() + .fetchEvent(filter, relays) + .then((event) => { + if (event) { + const extracted = extractModData(event) + setModData(extracted) + } + }) + .catch((err) => { + log( + true, + LogType.Error, + 'An error occurred in fetching mod details from relays', + err + ) + toast.error('An error occurred in fetching mod details from relays') + }) + .finally(() => { + setIsFetching(false) + }) + } + }) return (
@@ -12,10 +69,14 @@ export const SubmitModPage = () => {
-

Submit a mod

+

{title}

- + {isFetching ? ( + + ) : ( + + )}
diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 9892824..5fcf1a3 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -2,6 +2,7 @@ import { AboutPage } from '../pages/about' import { BlogsPage } from '../pages/blogs' import { GamesPage } from '../pages/games' import { HomePage } from '../pages/home' +import { InnerModPage } from '../pages/innerMod' import { ModsPage } from '../pages/mods' import { SettingsPage } from '../pages/settings' import { SubmitModPage } from '../pages/submitMod' @@ -12,9 +13,11 @@ export const appRoutes = { home: '/home', games: '/games', mods: '/mods', + modsInner: '/mods-inner/:nevent', about: '/about', blog: '/blog', submitMod: '/submit-mod', + editMod: '/edit-mod/:nevent', write: '/write', settingsProfile: '/settings-profile', settingsRelays: '/settings-relays', @@ -22,6 +25,9 @@ export const appRoutes = { settingsAdmin: '/settings-admin' } +export const getModsInnerPageRoute = (eventId: string) => + appRoutes.modsInner.replace(':nevent', eventId) + export const routes = [ { path: appRoutes.index, @@ -39,6 +45,10 @@ export const routes = [ path: appRoutes.mods, element: }, + { + path: appRoutes.modsInner, + element: + }, { path: appRoutes.about, element: @@ -51,6 +61,10 @@ export const routes = [ path: appRoutes.submitMod, element: }, + { + path: appRoutes.editMod, + element: + }, { path: appRoutes.write, element: diff --git a/src/styles/cardMod.css b/src/styles/cardMod.css index e59ff12..5244511 100644 --- a/src/styles/cardMod.css +++ b/src/styles/cardMod.css @@ -3,7 +3,7 @@ height: 100%; display: flex; flex-direction: column; - background: rgba(255,255,255,0.05); + background: rgba(255, 255, 255, 0.05); border-radius: 10px; overflow: hidden; background: linear-gradient(to top right, #262626, #292929, #262626); @@ -13,12 +13,12 @@ position: relative; width: 100%; padding-top: 56.25%; - background: rgba(0,0,0,0.1); + background: rgba(0, 0, 0, 0.1); } .cMMBody { padding: 15px; - color: rgba(255,255,255,0.5); + color: rgba(255, 255, 255, 0.5); display: flex; flex-direction: column; grid-gap: 15px; @@ -28,7 +28,7 @@ .cMMFoot { width: 100%; padding: 10px 25px; - border-top: solid 1px rgba(255,255,255,0.05); + border-top: solid 1px rgba(255, 255, 255, 0.05); font-size: 14px; display: flex; flex-direction: row; @@ -43,7 +43,8 @@ transform: scale(1); border-radius: 12px; padding: 2px; - box-shadow: 0 0 8px 0 rgb(0,0,0,0.05); + box-shadow: 0 0 8px 0 rgb(0, 0, 0, 0.05); + cursor: pointer; } .cardModMainWrapperLink:hover { @@ -60,7 +61,12 @@ .cardModMainWrapperLink::before { transition: ease 0.4s; - background: linear-gradient(to top, #8000ff 0%, #232323 50%, rgba(255,255,255,0) 100%); + background: linear-gradient( + to top, + #8000ff 0%, + #232323 50%, + rgba(255, 255, 255, 0) 100% + ); content: ''; position: absolute; top: 0; @@ -84,7 +90,7 @@ -webkit-line-clamp: 2; font-size: 20px; line-height: 1.25; - color: rgba(255,255,255,0.75); + color: rgba(255, 255, 255, 0.75); font-weight: bold; } @@ -93,7 +99,7 @@ -webkit-box-orient: vertical; overflow: hidden; -webkit-line-clamp: 3; - color: rgba(255,255,255,0.5); + color: rgba(255, 255, 255, 0.5); font-size: 15px; line-height: 1.5; } @@ -113,6 +119,5 @@ grid-gap: 5px; justify-content: center; align-items: center; - color: rgba(255,255,255,0.25); + color: rgba(255, 255, 255, 0.25); } - diff --git a/src/styles/comments.css b/src/styles/comments.css new file mode 100644 index 0000000..94bc835 --- /dev/null +++ b/src/styles/comments.css @@ -0,0 +1,479 @@ +.IBMSMSMBSSComments { + width: 100%; + display: flex; + flex-direction: column; + grid-gap: 25px; +} + +.IBMSMSMBSSCommentsList { + width: 100%; + display: grid; + grid-template-columns: 1fr; + grid-gap: 25px; +} + +.IBMSMSMBSSCL_Comment { + width: 100%; + display: grid; + grid-template-columns: 1fr; + grid-gap: 20px; +} + +.IBMSMSMBSSCL_CommentTop { + width: 100%; + display: flex; + flex-direction: row; + grid-gap: 15px; + padding: 0; +} + +.IBMSMSMBSSCL_CommentTopPP { + border-radius: 10px; + width: 60px; + height: 60px; + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); +} + +.IBMSMSMBSSCL_CommentTopDetails { + display: flex; + flex-direction: column; + flex-grow: 1; +} + +.IBMSMSMBSSCL_CommentBottom { + padding: 20px; + color: rgba(255,255,255,0.75); + background: linear-gradient(to top right, #262626, #292929, #262626); + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + border-radius: 10px; + /*border: solid 1px rgba(255,255,255,0.1);*/ +} + +.IBMSMSMBSSCL_CommentTopPPWrapper { + display: flex; + flex-direction: column; + justify-content: end; + align-items: center; +} + +.IBMSMSMBSSCL_CBText { +} + +.IBMSMSMBSSCL_CommentActions { + margin: -10px 0 0 0; + display: grid; + grid-template-columns: 1; + grid-gap: 25px; +} + +@media (max-width: 576px) { + .IBMSMSMBSSCL_CommentActions { + margin: -10px 0 0 0; + display: grid; + grid-template-columns: 1fr; + grid-gap: 25px; + } +} + +.IBMSMSMBSSCL_CAElement { + transition: ease 0.4s; + display: flex; + flex-direction: row; + align-items: center; + grid-gap: 10px; + padding: 5px 15px; + border-radius: 10px; + color: rgba(255,255,255,0.25); + font-weight: bold; + position: relative; + cursor: pointer; + font-size: 14px; + overflow: hidden; + transform: scale(1); + flex-wrap: wrap; +} + +@media (max-width: 576px) { + .IBMSMSMBSSCL_CAElement { + flex-grow: 1; + justify-content: center; + } +} + +.IBMSMSMBSSCL_CAElement:hover::before { + transition: ease 0.4s; + background: linear-gradient(to top right, #262626, #292929, #262626); + opacity: 1; +} + +.IBMSMSMBSSCL_CAElement::before { + transition: ease 0.4s; + background: linear-gradient(to top right, #262626, #292929, #262626); + opacity: 0; + content: ''; + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + z-index: -1; + border-radius: 10px; + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); +} + +.IBMSMSMBSSCL_CAElementText { +} + +.IBMSMSMBSSCL_CAElementIcon { + background: rgba(255,255,255,0); + font-size: 14px; +} + +.IBMSMSMBSSCL_CTD_Name { + font-weight: bold; + color: rgba(255,255,255,0.5); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + max-width: 200px; +} + +.IBMSMSMBSSCL_CTD_Address { + color: rgba(255,255,255,0.25); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + max-width: 150px; +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEReply { + border: solid 1px rgba(255,255,255,0.05); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEReply:hover { + transition: ease 0.4s; + border: solid 1px rgba(255,255,255,0.05); + color: rgba(255,255,255,0.5); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEReplies:hover { + transition: ease 0.4s; + color: rgba(173,90,255,0.75); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAERepost.IBMSMSMBSSCL_CAERepostActive { + color: rgba(255,255,255,0.75); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAERepost:hover { + transition: ease 0.4s; + color: rgba(255,255,255,0.75); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEDown:hover { + transition: ease 0.4s; + color: rgba(255,114,54,0.85); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEUp:hover { + transition: ease 0.4s; + color: rgba(255,70,70,0.85); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEBolt:hover { + transition: ease 0.4s; + color: rgba(255,255,0,0.85); +} + +.IBMSMSMBSSCL_CAElement:hover { + transition: ease 0.4s; + transform: scale(1.05); +} + +.IBMSMSMBSSCL_CAElement:active { + transition: ease 0.1s; + transform: scale(0.95); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEUp.IBMSMSMBSSCL_CAEUpActive { + color: rgba(255,70,70,0.85); +} + +.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAElement.IBMSMSMBSSCL_CAEBolt.IBMSMSMBSSCL_CAEBoltActive { + color: rgba(255,255,0,0.85); +} + +.IBMSMSMBSSCL_CommentActionsInside { + display: flex; + flex-direction: row; + justify-content: end; + flex-wrap: wrap; + grid-gap: 10px; +} + +.IBMSMSMBSSCL_CommentActionsDetails { + color: rgba(255,255,255,0.25); + font-size: 16px; + display: flex; + flex-direction: column; + justify-content: start; + align-items: end; + grid-gap: 5px; + line-height: 1; + flex-grow: 1; +} + +@media (max-width: 576px) { + .IBMSMSMBSSCL_CommentActionsDetails { + flex-direction: row; + justify-content: end; + grid-gap: 10px; + } +} + +.IBMSMSMBSSCL_CADDate { + transition: ease 0.4s; + color: rgba(255,255,255,0.25); +} + +.IBMSMSMBSSCL_CADTime { + transition: ease 0.4s; + color: rgba(255,255,255,0.25); +} + +.IBMSMSMBSSCL_CommentTopDetailsWrapper { + width: 100%; + display: grid; + grid-template-columns: 1fr 1fr; + grid-gap: 15px; + flex-wrap: wrap; + align-items: end; +} + +@media (max-width: 576px) { + .IBMSMSMBSSCL_CommentTopDetailsWrapper { + grid-template-columns: 1fr; + } +} + +.IBMSMSMBSSCommentsCreation { + padding: 0; + display: flex; + flex-direction: column; + grid-gap: 15px; +} + +.IBMSMSMBSSCC_Top { +} + +.IBMSMSMBSSCC_Bottom { + display: flex; + flex-direction: row; + justify-content: end; + align-items: start; + grid-gap: 10px; +} + +.IBMSMSMBSSCC_Top_Box { + transition: border, background, box-shadow ease 0.4s; + width: 100%; + background: rgba(0,0,0,0.05); + border: solid 1px rgba(255,255,255,0.05); + box-shadow: inset 0 0 8px 0 rgb(0,0,0,0.1); + border-radius: 10px; + min-height: 100px; + height: 100px; + min-width: 100%; + outline: unset; + padding: 15px 20px; + color: rgba(255,255,255,0.75); +} + +@media (max-width: 576px) { + .IBMSMSMBSSCC_Top_Box { + padding: 15px 15px; + height: 100px; + } +} + +.IBMSMSMBSSCC_Top_Box:focus, hover { + transition: border, background, box-shadow ease 0.4s; + background: rgba(0,0,0,0.1); + border: solid 1px rgba(255,255,255,0.1); + box-shadow: inset 0 0 8px 0 rgb(0,0,0,0.15); + outline: unset; +} + +.IBMSMSMBSSCC_BottomButton { + transition: ease 0.4s; + text-decoration: unset; + color: rgba(255,255,255,0.25); + font-weight: bold; + padding: 10px 20px; + border-radius: 10px; + box-shadow: 0 0 8px 0 rgba(0,0,0,0); + font-size: 16px; + transform: scale(1); + position: relative; + cursor: pointer; + border: solid 1px rgba(255,255,255,0.1); + overflow: hidden; +} + +.IBMSMSMBSSCC_BottomButton:hover { + transition: ease 0.4s; + text-decoration: unset; + color: rgba(255,255,255,0.75); + border-radius: 10px; + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + font-size: 16px; + transform: scale(1.03); + /*border: solid 1px rgba(255,255,255,0);*/ +} + +.IBMSMSMBSSCC_BottomButton:active { + transition: ease 0.1s; + transform: scale(0.98); +} + +.IBMSMSMBSSCC_BottomButton::before { + transition: ease 0.4s; + background: linear-gradient(to top right, #262626, #292929, #262626); + opacity: 0; + content: ''; + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + z-index: -1; + border-radius: 10px; +} + +.IBMSMSMBSSCC_BottomButton:hover::before { + transition: ease 0.4s; + background: linear-gradient(to top right, #262626, #292929, #262626); + opacity: 1; +} + +.IBMSMSMBSSCL_CommentTopOther { + display: flex; + flex-direction: row; + justify-content: end; + align-items: end; + flex-grow: 1; + grid-gap: 10px; +} + +.IBMSMSMBSSCL_CTO { + transition: ease 0.4s; + display: flex; + flex-direction: row; + border-radius: 10px; + border: solid 1px rgba(255,255,255,0.1); + overflow: hidden; + color: rgba(255,255,255,0.25); + font-size: 14px; +} + +@media (max-width: 576px) { + .IBMSMSMBSSCL_CTO { + width: 100%; + } +} + +.IBMSMSMBSSCL_CTOLink { + transition: ease 0.4s; + padding: 5px 10px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + background: rgba(255,255,255,0.05); + color: rgba(255,255,255,0.25); +} + +.IBMSMSMBSSCL_CTOLink:hover { + transition: ease 0.4s; + background: rgba(255,255,255,0.1); + color: rgba(255,255,255,0.5); +} + +.IBMSMSMBSSCL_CTOLink:active > .IBMSMSMBSSCL_CTOLinkIcon { + transition: ease 0.1s; + transform: scale(0.9); +} + +.IBMSMSMBSSCL_CTOText { + transition: ease 0.4s; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + padding: 5px 10px; +} + +.CommentsToggle { + width: 100%; + display: flex; + flex-direction: row; + grid-gap: 15px; + /*padding: 10px;*/ + /*background: rgba(0,0,0,0.05);*/ + border-radius: 10px; + /*border: solid 1px rgba(255,255,255,0.05);*/ +} + +@media (max-width: 576px) { + .CommentsToggle { + flex-direction: column; + } +} + +.btnMain.CommentsToggleBtn { + flex-grow: 1; + background: unset; + box-shadow: unset; + font-weight: normal; + border-radius: 7px; +} + +.btnMain.CommentsToggleBtn.CommentsToggleActive { + background: rgba(255,255,255,0.1); + font-weight: bold; +} + +.IBMSMSMBSSCommentsWrapper { + display: flex; + flex-direction: column; + grid-gap: 25px; +} + +.IBMSMSMBSSTitle { + color: rgba(255,255,255,0.5); +} + +.IBMSMSMBSSCL_CommentNoteRepliesTitle { + color: rgba(255,255,255,0.5); +} + +.IBMSMSMBSSCL_CAElementLoadWrapper { + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 2px; + display: flex; + flex-direction: row; +} + +.IBMSMSMBSSCL_CAElementLoad { + background: rgba(255,255,255,0.5); + width: 0%; +} + +.btnMain.IBMSMSMBSSCL_CTOBtn { + padding: 5px 10px; + height: 100%; +} + diff --git a/src/styles/downloads.css b/src/styles/downloads.css new file mode 100644 index 0000000..0ff3847 --- /dev/null +++ b/src/styles/downloads.css @@ -0,0 +1,249 @@ +.IBMSMSMBSSDownloadsWrapper { + width: 100%; + display: flex; + flex-direction: column; + grid-gap: 15px; +} + +.IBMSMSMBSSDownloads { + width: 100%; + border-radius: 10px; + display: grid; + grid-template-columns: 1fr; + grid-gap: 15px; + border: solid 1px rgba(255,255,255,0.05); + overflow: auto; + max-height: 550px; + padding: 15px; +} + +@media (max-width: 768px) { + .IBMSMSMBSSDownloads { + grid-template-columns: 1fr; + } +} + +.IBMSMSMBSSDownloadsPrime { +} + +.IBMSMSMBSSDownloadsTitle { + color: rgba(255,255,255,0.5); +} + +.IBMSMSMBSSDownloadsElement { + transition: ease 0.4s; + width: 100%; + display: grid; + grid-template-columns: 1fr; + grid-gap: 10px; + border: solid 1px rgba(255,255,255,0); + background: rgba(255,255,255,0.05); + padding: 10px; + border-radius: 10px; + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); +} + +@media (max-width: 768px) { + .IBMSMSMBSSDownloadsElement { + grid-template-columns: 1fr; + } +} + +.btnMain.IBMSMSMBSSDownloadsElementBtn { + background: rgba(255,255,255,0.05); + border-radius: 10px; + width: 100%; +} + +@media (max-width: 768px) { + .btnMain.IBMSMSMBSSDownloadsElementBtn { + order: 3; + } +} + +.btnMain.IBMSMSMBSSDownloadsElementBtn:hover { + background: rgba(255,255,255,0.1); + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); +} + +.IBMSMSMBSSDownloadsElementInside { + display: flex; + flex-direction: column; + justify-content: start; + align-items: start; + color: rgba(255,255,255,0.5); + grid-gap: 10px; +} + +.IBMSMSMBSSDownloadsElementInsideReactions { + width: 100%; + display: flex; + flex-direction: row; + grid-gap: 10px; + height: 100%; +} + +@media (max-width: 576px) { + .IBMSMSMBSSDownloadsElementInsideReactions { + flex-direction: column; + } +} + +.IBMSMSMBSSDEIReactionsElement { + transition: ease 0.4s; + display: grid; + grid-template-columns: 0.5fr 1.5fr; + grid-gap: 0px; + justify-content: center; + align-items: center; + width: 100%; + background: rgba(255,255,255,0); + overflow: hidden; + border-radius: 10px; + border: solid 1px rgba(255,255,255,0.05); + cursor: pointer; +} + +.IBMSMSMBSSDEIReactionsElement:hover { + transition: ease 0.4s; + background: rgba(255,255,255,0.05); + color: rgba(255,255,255,0.75); + border: solid 1px rgba(255,255,255,0); +} + +.IBMSMSMBSSDEIReactionsElement:hover > .IBMSMSMBSSDEIReactionsElementIconWrapper { + transition: ease 0.4s; + background: rgba(255,255,255,0.05); + border-right: solid 1px rgba(255,255,255,0); +} + +.IBMSMSMBSSDEIReactionsElement:hover > .IBMSMSMBSSDEIReactionsElementIconWrapper > .IBMSMSMBSSDEIReactionsElementIcon { + transform: scale(1.1); +} + +.IBMSMSMBSSDEIReactionsElementIcon { + transition: ease 0.4s; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.IBMSMSMBSSDEIReactionsElementText { + text-align: center; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; + padding: 5px 5px; +} + +.IBMSMSMBSSDEIReactionsElementIconWrapper { + transition: ease 0.4s; + font-size: 18px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; + background: rgba(255,255,255,0); + padding: 10px 5px; + border-right: solid 1px rgba(255,255,255,0.05); +} + +.IBMSMSMBSSDownloadsElementInsideDetails { + width: 100%; + display: flex; + flex-direction: column; + grid-gap: 10px; +} + +.IBMSMSMBSSDEIReactionsElement.IBMSMSMBSSDEIReactionsElementActive { + background: rgba(255,255,255,0.05); + border: solid 1px rgba(255,255,255,0); +} + +.IBMSMSMBSSDEIReactionsElement.IBMSMSMBSSDEIReactionsElementActive > .IBMSMSMBSSDEIReactionsElementIconWrapper { + background: rgba(255,255,255,0.05); + border-right: solid 1px rgba(255,255,255,0); +} + +.IBMSMSMBSSDEIReactionsElement.IBMSMSMBSSDEIReactionsElementActive > .IBMSMSMBSSDEIReactionsElementIconWrapper > .IBMSMSMBSSDEIReactionsElementIcon { + color: rgba(255,255,255,0.75); +} + +.IBMSMSMBSSDownloadsActions { + width: 100%; + display: flex; + flex-direction: row; +} + +.IBMSMSMBSSDownloadsElementInside.IBMSMSMBSSDownloadsElementInsideAlt { + align-items: center; +} + +.IBMSMSMBSSDownloadsElementInsideAltTable { + width: 100%; + display: flex; + flex-direction: column; + border-radius: 10px; + border: solid 1px rgba(255,255,255,0.1); + overflow: auto; + grid-gap: 1px; +} + +.IBMSMSMBSSDownloadsElementInsideAltTableRow { + transition: ease 0.4s; + display: flex; + flex-direction: row; + grid-gap: 0px; +} + +.IBMSMSMBSSDownloadsElementInsideAltTableRow:hover { + transition: ease 0.4s; + background: rgba(255,255,255,0.05); +} + +@media (max-width: 576px) { + .IBMSMSMBSSDownloadsElementInsideAltTableRow { + flex-direction: column; + } +} + +.IBMSMSMBSSDownloadsElementInsideAltTableRowCol { + width: 100%; + text-align: start; + padding: 10px 15px; +} + +.IBMSMSMBSSDownloadsElementInsideAltTableRowCol.IBMSMSMBSSDownloadsElementInsideAltTableRowColFirst { + text-align: center; + font-weight: bold; + max-width: 200px; + background: rgba(255,255,255,0.05); + display: flex; + justify-content: center; + align-items: center; +} + +@media (max-width: 576px) { + .IBMSMSMBSSDownloadsElementInsideAltTableRowCol.IBMSMSMBSSDownloadsElementInsideAltTableRowColFirst { + max-width: unset; + } +} + +.IBMSMSMBSSDownloadsElementInsideAltText { + transition: ease 0.4s; + cursor: pointer; + font-weight: 400; + color: rgba(255,255,255,0.25); +} + +.IBMSMSMBSSDownloadsElementInsideAltText:hover { + transition: ease 0.4s; + cursor: pointer; + font-weight: 600; + color: rgba(255,255,255,0.75); +} + diff --git a/src/styles/loadingSpinner.module.scss b/src/styles/loadingSpinner.module.scss new file mode 100644 index 0000000..b83b70b --- /dev/null +++ b/src/styles/loadingSpinner.module.scss @@ -0,0 +1,37 @@ +.loadingSpinnerOverlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + background-color: rgba(0, 0, 0, 0.5); + z-index: 9999; + + .loadingSpinnerContainer { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } + + .loadingSpinner { + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 40px; + height: 40px; + animation: spin 1s linear infinite; + } +} + +@keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/src/styles/pagination.css b/src/styles/pagination.css index 2e739b1..a59fe41 100644 --- a/src/styles/pagination.css +++ b/src/styles/pagination.css @@ -35,19 +35,23 @@ flex-direction: column; justify-content: center; align-items: center; - background: rgba(35,35,35,0); + background: rgba(35, 35, 35, 0); border-radius: 10px; height: 100%; - box-shadow: 0 0 8px 0 rgba(0,0,0,0); + box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0); transform: scale(1); - border: solid 1px rgba(255,255,255,0); - color: rgba(255,255,255,0.1); + border: solid 1px rgba(255, 255, 255, 0); + color: rgba(255, 255, 255, 0.1); font-weight: bold; } .PaginationMainInsideBox.PaginationMainInsideBoxArrows { } +.PaginationMainInsideBox.PaginationMainInsideBoxArrows:disabled { + cursor: not-allowed; +} + @media (max-width: 768px) { .PaginationMainInsideBox.PaginationMainInsideBoxArrows { order: 2; @@ -60,10 +64,10 @@ text-decoration: unset; color: unset; background: linear-gradient(to top right, #232323, #262626, #232323); - box-shadow: 0 0 16px 0 rgba(0,0,0,0.1); + box-shadow: 0 0 16px 0 rgba(0, 0, 0, 0.1); transform: scale(1.01); - border: solid 1px rgba(255,255,255,0.1); - color: rgba(255,255,255,0.85); + border: solid 1px rgba(255, 255, 255, 0.1); + color: rgba(255, 255, 255, 0.85); } .PaginationMainInsideBox:active { @@ -76,8 +80,8 @@ text-decoration: unset; color: unset; transform: scale(1.01); - border: solid 1px rgba(255,255,255,0.1); - color: rgba(255,255,255,0.75); + border: solid 1px rgba(255, 255, 255, 0.1); + color: rgba(255, 255, 255, 0.75); } .PMIBDots { @@ -100,4 +104,3 @@ justify-content: space-around; } } - diff --git a/src/styles/post.css b/src/styles/post.css new file mode 100644 index 0000000..fcc8294 --- /dev/null +++ b/src/styles/post.css @@ -0,0 +1,219 @@ +.IBMSMSMBSSPost { + width: 100%; + overflow: hidden; + border-radius: 15px; + display: flex; + flex-direction: column; + align-items: center; + grid-gap: 25px; + background: rgba(255,255,255,0.05); + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + position: relative; + padding: 0 0 50px 0; +} + +.IBMSMSMBSSPostPicture { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding-top: 56.25%; +} + +.IBMSMSMBSSPostTitle { + width: 100%; + padding: 15px; + padding: 0px; + display: flex; + flex-direction: column; + align-items: center; +} + +.IBMSMSMBSSPostBody { + width: 100%; + padding: 0; + display: flex; + flex-direction: column; + align-items: center; + position: relative; + overflow: hidden; +} + +.IBMSMSMBSSPostTitleHeading { + width: 100%; +} + +.IBMSMSMBSSPostTitleText { + width: 100%; +} + +.IBMSMSMBSSPostInside { + display: flex; + flex-direction: column; + grid-gap: 25px; + padding: 0 15px; + width: 100%; + max-width: 775px; +} + +.IBMSMSMBSSPostImg { + width: 100%; + margin: 15px 0; + background: #232323; + border-radius: 10px; +} + +.IBMSMSMBSSPost_PostDetails { + width: 100%; + height: 100%; + display: flex; + flex-direction: row; + grid-gap: 5px; + border-radius: 15px; + overflow: hidden; + padding: 5px 15px; + border: solid 1px rgba(255,255,255,0.1); + justify-content: space-around; +} + +@media (max-width: 576px) { + .IBMSMSMBSSPost_PostDetails { + flex-direction: column; + } +} + +.IBMSMSMBSSPost_PDElement { + transition: ease 0.4s; + /*width: 100%;*/ + display: flex; + flex-direction: row; + grid-gap: 10px; + justify-content: start; + align-items: center; + color: rgba(255,255,255,0.25); + padding: 10px 15px; + border-radius: 10px; + position: relative; +} + +.IBMSMSMBSSPost_PDElementLink::before { + transition: ease 0.4s; + background: linear-gradient(to top right, #262626, #292929, #262626); + opacity: 0; + content: ''; + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + z-index: -1; + border-radius: 10px; +} + +.IBMSMSMBSSPost_PDElementLink:hover::before { + transition: ease 0.4s; + background: linear-gradient(to top right, #262626, #292929, #262626); + opacity: 1; +} + +.IBMSMSMBSSPost_PDElementIcon { +} + +.IBMSMSMBSSPost_PDElementText { +} + +.IBMSMSMBSSPost_PDElement.IBMSMSMBSSPost_PDElementLink { + transition: ease 0.4s; + text-decoration: unset; +} + +.IBMSMSMBSSPost_PDElement.IBMSMSMBSSPost_PDElementLink:hover { + transition: ease 0.4s; + text-decoration: unset; + color: rgba(255,255,255,0.75); + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); +} + +.IBMSMSMBSSPostBodyHide { + bottom: 0; + left: 0; + right: 0; + height: 100%; + position: absolute; + border: solid 1px rgba(255,255,255,0.1); + border-radius: 10px; + background: linear-gradient(rgba(0,0,0,0) 0%, #232323 100%); + display: flex; + flex-direction: column; + justify-content: end; + align-items: center; + padding: 15px; + color: rgba(255,255,255,0.75); + font-weight: bold; + cursor: pointer; + box-shadow: inset 0 0 8px 0 rgb(0,0,0,0.1); +} + +.IBMSMSMBSSModFor { + width: 100%; + border-radius: 10px; + padding: 15px; + color: rgba(255,255,255,0.65); + background: rgba(255,255,255,0.05); + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; +} + +.IBMSMSMBSSModForPara { + font-weight: bold; +} + +.IBMSMSMBSSModForLink { + transition: ease 0.4s; + font-weight: normal; + color: rgba(255,255,255,0.5); + text-decoration: none; +} + +.IBMSMSMBSSModForLink:hover { + transition: ease 0.4s; + color: rgba(255,255,255,0.75); + text-decoration: underline; +} + +.IBMSMSMBSSShots { + max-width: 100%; + min-width: 0px; + overflow-x: auto; + display: flex; + flex-direction: row; + grid-gap: 10px; + background: rgba(0,0,0,0.1); + border-radius: 10px; + padding: 10px; + box-shadow: inset 0 0 8px 0 rgb(0,0,0,0.1); +} + +.IBMSMSMBSSShotsImg { + min-width: 250px; + border-radius: 10px; + overflow: hidden; + height: 140.625px; + object-fit: cover; + cursor: pointer; +} + +.IBMSMSMBSSPostsWrapper { + display: flex; + flex-direction: column; + grid-gap: 15px; +} + +.IBMSMSMBSSPostsTitle { + color: rgba(255,255,255,0.5); +} + diff --git a/src/styles/reactions.css b/src/styles/reactions.css new file mode 100644 index 0000000..339c552 --- /dev/null +++ b/src/styles/reactions.css @@ -0,0 +1,100 @@ +.IBMSMSMBSS_Details { + width: 100%; + display: flex; + flex-direction: row; + grid-gap: 15px; + /*background: linear-gradient(to top right, #262626, #292929, #262626);*/ + /*box-shadow: 0 0 8px 0 rgb(0,0,0,0.1);*/ + flex-wrap: wrap; +} + +@media (max-width: 768px) { + .IBMSMSMBSS_Details { + display: grid; + grid-template-columns: 1fr 1fr; + } +} + +.IBMSMSMBSS_Details_Card { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + background: linear-gradient(to top right, #262626, #292929, #262626); + border-radius: 10px; + overflow: hidden; + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + color: rgba(255,255,255,0.25); + cursor: pointer; + position: relative; +} + +.IBMSMSMBSS_Details_Card:hover > .IBMSMSMBSS_Details_CardVisual > .IBMSMSMBSS_Details_CardVisualIcon { + transition: ease 0.4s; + transform: scale(1.1); +} + +.IBMSMSMBSS_Details_Card:active > .IBMSMSMBSS_Details_CardVisual > .IBMSMSMBSS_Details_CardVisualIcon { + transition: ease 0.2s; + transform: scale(0.95); +} + +.IBMSMSMBSS_Details_CardVisual { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 15px; + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + background: rgba(255,255,255,0.05); + font-size: 20px; +} + +.IBMSMSMBSS_Details_CardText { + transition: ease 0.4s; + text-align: center; + width: 100%; + font-weight: bold; + margin: 0 15px; + min-width: 50px; +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CBolt:hover { + color: rgba(255,255,0,0.85); +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CComments:hover { + color: rgba(173,90,255,0.75); +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CReactUp:hover { + color: rgba(255,70,70,0.85); +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CReactDown:hover { + color: rgba(255,114,54,0.85); +} + +.IBMSMSMBSS_Details_CardText:hover { + transition: ease 0.4s; +} + +.IBMSMSMBSS_Details_CardVisualIcon { + transition: ease 0.4s; +} + +.HBLA_Details_Card:hover { +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CReactUp.IBMSMSMBSS_D_CRUActive { + color: rgba(255,70,70,0.85); +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CReactDown.IBMSMSMBSS_D_CRDActive { + color: rgba(255,114,54,0.85); +} + +.IBMSMSMBSS_Details_Card.IBMSMSMBSS_D_CBolt.IBMSMSMBSS_D_CBActive { + color: rgba(255,255,0,0.85); +} + diff --git a/src/styles/tabs.css b/src/styles/tabs.css new file mode 100644 index 0000000..840924f --- /dev/null +++ b/src/styles/tabs.css @@ -0,0 +1,58 @@ +.tabsMain { + width: 100%; + display: flex; + flex-direction: column; + grid-gap: 10px; + padding: 10px; + background: rgba(0,0,0,0.1); + border-radius: 10px; + border: solid 1px rgba(255,255,255,0.05); +} + +.tabsMainTop { + width: 100%; + display: flex; + flex-direction: row; + grid-gap: 10px; + border: unset; + padding: 0; + background: rgba(0,0,0,0); +} + +.tabsMainTopTab { + flex-grow: 1; + text-align: center; +} + +.nav-link.tabsMainTopTabLink { + color: rgba(255,255,255,0.5); + font-weight: normal; + background: rgba(255,255,255,0); + border: unset; + border-radius: 8px; + padding: 5px; +} + +.nav-link.active.tabsMainTopTabLink { + color: rgba(255,255,255,0.75); + font-weight: bold; + background: rgba(255,255,255,0.05); +} + +.tabsMainBottom { +} + +.tab-pane.tabsMainBottomContent { +} + +.tab-pane.active.tabsMainBottomContent { +} + +.tabsMain.tabsMainAlt { + border-radius: 0px; + border: unset; + border-bottom: solid 1px rgba(255,255,255,0.05); + padding: 20px 10px; + grid-gap: 20px; +} + diff --git a/src/styles/tags.css b/src/styles/tags.css new file mode 100644 index 0000000..1de956f --- /dev/null +++ b/src/styles/tags.css @@ -0,0 +1,36 @@ +.IBMSMSMBSSTags { + width: 100%; + display: flex; + flex-direction: row; + justify-content: start; + align-items: start; + grid-gap: 10px; + flex-wrap: wrap; +} + +.IBMSMSMBSSTagsTag { + transition: ease 0.4s; + padding: 5px 15px; + border-radius: 10px; + background: rgba(255,255,255,0); + color: rgba(255,255,255,0.25); + text-decoration: unset; + text-align: center; + cursor: pointer; + box-shadow: 0 0 8px 0 rgba(0,0,0,0); + border: solid 1px rgba(255,255,255,0.05); +} + +.IBMSMSMBSSTagsTag:hover { + transition: ease 0.4s; + transform: scale(1.02); + color: rgba(255,255,255,0.5); + box-shadow: 0 0 8px 0 rgb(0,0,0,0.1); + background: rgba(255,255,255,0.05); +} + +.IBMSMSMBSSTagsTag:active { + transition: ease 0.1s; + transform: scale(0.98); +} + diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..ce551f7 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,2 @@ +export * from './mod' +export * from './user' diff --git a/src/types/mod.ts b/src/types/mod.ts new file mode 100644 index 0000000..06650af --- /dev/null +++ b/src/types/mod.ts @@ -0,0 +1,36 @@ +export interface ModFormState { + dTag: string + aTag: string + rTag: string + game: string + title: string + body: string + featuredImageUrl: string + summary: string + nsfw: boolean + screenshotsUrls: string[] + tags: string + downloadUrls: DownloadUrl[] +} + +export interface DownloadUrl { + url: string + hash: string + signatureKey: string + malwareScanLink: string + modVersion: string + customNote: string +} + +export interface ModDetails extends Omit { + id: string + published_at: number + edited_at: number + author: string + tags: string[] +} + +export interface MuteLists { + authors: string[] + eventIds: string[] +} diff --git a/src/utils/index.ts b/src/utils/index.ts index 1dd5f84..910cb10 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,3 +1,4 @@ +export * from './mod' export * from './nostr' export * from './url' export * from './utils' diff --git a/src/utils/mod.ts b/src/utils/mod.ts new file mode 100644 index 0000000..b85376f --- /dev/null +++ b/src/utils/mod.ts @@ -0,0 +1,186 @@ +import { Event, Filter, kinds } from 'nostr-tools' +import { getTagValue } from './nostr' +import { ModFormState, ModDetails } from '../types' +import { RelayController } from '../controllers' +import { log, LogType } from './utils' +import { toast } from 'react-toastify' +import { T_TAG_VALUE } from '../constants' + +/** + * Extracts and normalizes mod data from an event. + * + * This function extracts specific tag values from an event and maps them to properties + * of a `PageData` object. It handles default values and type conversions as needed. + * + * @param event - The event object from which to extract data. + * @returns A `Partial` object containing extracted data. + */ +export const extractModData = (event: Event): ModDetails => { + // Helper function to safely get the first value of a tag or return a default value + const getFirstTagValue = (tagIdentifier: string, defaultValue = '') => { + const tagValue = getTagValue(event, tagIdentifier) + return tagValue ? tagValue[0] : defaultValue + } + + // Helper function to safely parse integer values from tags + const getIntTagValue = (tagIdentifier: string, defaultValue: number = -1) => { + const tagValue = getTagValue(event, tagIdentifier) + return tagValue ? parseInt(tagValue[0], 10) : defaultValue + } + + return { + id: event.id, + dTag: getFirstTagValue('d'), + aTag: getFirstTagValue('a'), + rTag: getFirstTagValue('r'), + author: event.pubkey, + edited_at: event.created_at, + body: event.content, + published_at: getIntTagValue('published_at'), + game: getFirstTagValue('game'), + title: getFirstTagValue('title'), + featuredImageUrl: getFirstTagValue('featuredImageUrl'), + summary: getFirstTagValue('summary'), + nsfw: getFirstTagValue('nsfw') === 'true', + screenshotsUrls: getTagValue(event, 'screenshotsUrls') || [], + tags: getTagValue(event, 'tags') || [], + downloadUrls: (getTagValue(event, 'downloadUrls') || []).map((item) => + JSON.parse(item) + ) + } +} + +/** + * Constructs a list of `ModDetails` objects from an array of events. + * + * This function filters out events that do not contain all required data, + * extracts the necessary information from the valid events, and constructs + * `ModDetails` objects. + * + * @param events - The array of event objects to be processed. + * @returns An array of `ModDetails` objects constructed from valid events. + */ +export const constructModListFromEvents = (events: Event[]): ModDetails[] => { + // Filter and extract mod details from events + const modDetailsList: ModDetails[] = events + .filter(isModDataComplete) // Filter out incomplete events + .map((event) => extractModData(event)) // Extract data and construct ModDetails + + return modDetailsList +} + +/** + * Checks if the provided event contains all the required data for constructing a `ModDetails` object. + * + * This function verifies that the event has the necessary tags and values to construct a `ModDetails` object. + * + * @param event - The event object to be checked. + * @returns `true` if the event contains all required data; `false` otherwise. + */ +export const isModDataComplete = (event: Event): boolean => { + // Helper function to check if a tag value is present and not empty + const hasTagValue = (tagIdentifier: string): boolean => { + const value = getTagValue(event, tagIdentifier) + return !!value && value.length > 0 && value[0].trim() !== '' + } + + // Check if all required fields are present + return ( + hasTagValue('d') && + hasTagValue('a') && + hasTagValue('t') && + hasTagValue('published_at') && + hasTagValue('game') && + hasTagValue('title') && + hasTagValue('featuredImageUrl') && + hasTagValue('summary') && + hasTagValue('nsfw') && + getTagValue(event, 'screenshotsUrls') !== null && + getTagValue(event, 'tags') !== null && + getTagValue(event, 'downloadUrls') !== null + ) +} + +/** + * Initializes the form state with values from existing mod data or defaults. + * + * @param existingModData - An optional object containing existing mod details. If provided, its values will be used to populate the form state. + * @returns The initial state for the form, with values from existingModData if available, otherwise default values. + */ +export const initializeFormState = ( + existingModData?: ModDetails +): ModFormState => ({ + dTag: existingModData?.dTag || '', + aTag: existingModData?.aTag || '', + rTag: existingModData?.rTag || window.location.host, + game: existingModData?.game || '', + title: existingModData?.title || '', + body: existingModData?.body || '', + featuredImageUrl: existingModData?.featuredImageUrl || '', + summary: existingModData?.summary || '', + nsfw: existingModData?.nsfw || false, + screenshotsUrls: existingModData?.screenshotsUrls || [''], + tags: existingModData?.tags.join(',') || '', + downloadUrls: existingModData?.downloadUrls || [ + { + url: '', + hash: '', + signatureKey: '', + malwareScanLink: '', + modVersion: '', + customNote: '' + } + ] +}) + +/** + * Fetches a list of mods based on the provided source. + * + * @param source - The source URL to filter the mods. If it matches the current window location, + * it adds a filter condition to the request. + * @param until - Optional timestamp to filter events until this time. + * @param since - Optional timestamp to filter events from this time. + * @returns A promise that resolves to an array of `ModDetails` objects. In case of an error, + * it logs the error and shows a notification, then returns an empty array. + */ +export const fetchMods = async ( + source: string, + until?: number, + since?: number +): Promise => { + // Define the filter criteria for fetching mods + const filter: Filter = { + kinds: [kinds.ClassifiedListing], // Specify the kind of events to fetch + limit: 20, // Limit the number of events fetched to 20 + '#t': [T_TAG_VALUE], + until, // Optional filter to fetch events until this timestamp + since // Optional filter to fetch events from this timestamp + } + + // If the source matches the current window location, add a filter condition + if (source === window.location.host) { + filter['#r'] = [window.location.host] // Add a tag filter for the current host + } + + // Fetch events from the relay using the defined filter + return RelayController.getInstance() + .fetchEvents(filter, []) // Pass the filter and an empty array of options + .then((events) => { + console.log('events :>> ', events) + + // Convert the fetched events into a list of mods + const modList = constructModListFromEvents(events) + return modList // Return the list of mods + }) + .catch((err) => { + // Log the error and show a notification if fetching fails + log( + true, + LogType.Error, + 'An error occurred in fetching mods from relays', + err + ) + toast.error('An error occurred in fetching mods from relays') // Show error notification + return [] as ModDetails[] // Return an empty array in case of an error + }) +} diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index 92649b6..0aa99d1 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -1,4 +1,4 @@ -import { nip19 } from 'nostr-tools' +import { nip19, Event } from 'nostr-tools' /** * Get the current time in seconds since the Unix epoch (January 1, 1970). @@ -9,7 +9,7 @@ import { nip19 } from 'nostr-tools' * * @returns {number} The current time in seconds since the Unix epoch. */ -export const now = () => Math.round(Date.now() / 1000) +export const now = (): number => Math.round(Date.now() / 1000) /** * Converts a hexadecimal public key to an npub format. @@ -25,3 +25,62 @@ export const hexToNpub = (hexPubkey: string): `npub1${string}` => { // Convert the hexadecimal public key to npub format using the nip19 encoder return nip19.npubEncode(hexPubkey) } + +/** + * Retrieves the value associated with a specific tag identifier from an event. + * + * This function searches the `tags` array of an event to find a tag that matches the given + * `tagIdentifier`. If a matching tag is found, it returns the associated value(s). + * If no matching tag is found, it returns `null`. + * + * @param event - The event object containing the tags. + * @param tagIdentifier - The identifier of the tag to search for. + * @returns {string | null} The value(s) associated with the specified tag identifier, or `null` if the tag is not found. + */ +export const getTagValue = ( + event: Event, + tagIdentifier: string +): string[] | null => { + // Find the tag in the event's tags array where the first element matches the tagIdentifier. + const tag = event.tags.find((item) => item[0] === tagIdentifier) + + // If a matching tag is found, return the rest of the elements in the tag (i.e., the values). + if (tag) { + return tag.slice(1) // Slice to remove the identifier, returning only the values. + } + + // Return null if no matching tag is found. + return null +} + +/** + * @param hexKey hex private or public key + * @returns whether or not is key valid + */ +const validateHex = (hexKey: string) => { + return hexKey.match(/^[a-f0-9]{64}$/) +} + +/** + * NPUB provided - it will convert NPUB to HEX + * HEX provided - it will return HEX + * + * @param pubKey in NPUB, HEX format + * @returns HEX format + */ +export const npubToHex = (pubKey: string): string | null => { + // If key is NPUB + if (pubKey.startsWith('npub1')) { + try { + return nip19.decode(pubKey).data as string + } catch (error) { + return null + } + } + + // valid hex key + if (validateHex(pubKey)) return pubKey + + // Not a valid hex key + return null +} diff --git a/src/utils/url.ts b/src/utils/url.ts index 29b9be0..711432c 100644 --- a/src/utils/url.ts +++ b/src/utils/url.ts @@ -1,3 +1,51 @@ +/** + * Normalizes a given URL by performing the following operations: + * + * 1. Ensures that the URL has a protocol by defaulting to 'wss://' if no protocol is provided. + * 2. Creates a `URL` object to easily manipulate and normalize the URL components. + * 3. Normalizes the pathname by: + * - Replacing multiple consecutive slashes with a single slash. + * - Removing the trailing slash if it exists. + * 4. Removes the port number if it is the default port for the protocol: + * - Port `80` for 'ws:' (WebSocket) protocol. + * - Port `443` for 'wss:' (WebSocket Secure) protocol. + * 5. Sorts the query parameters alphabetically. + * 6. Clears any fragment (hash) identifier from the URL. + * + * @param urlString - The URL string to be normalized. + * @returns A normalized URL string. + */ +export function normalizeWebSocketURL(urlString: string): string { + // If the URL string does not contain a protocol (e.g., "http://", "https://"), + // prepend "wss://" (WebSocket Secure) by default. + if (urlString.indexOf('://') === -1) urlString = 'wss://' + urlString + + // Create a URL object from the provided URL string. + const url = new URL(urlString) + + // Normalize the pathname by replacing multiple consecutive slashes with a single slash. + url.pathname = url.pathname.replace(/\/+/g, '/') + + // Remove the trailing slash from the pathname if it exists. + if (url.pathname.endsWith('/')) url.pathname = url.pathname.slice(0, -1) + + // Remove the port number if it is 80 for "ws:" protocol or 443 for "wss:" protocol, as these are default ports. + if ( + (url.port === '80' && url.protocol === 'ws:') || + (url.port === '443' && url.protocol === 'wss:') + ) + url.port = '' + + // Sort the search parameters alphabetically. + url.searchParams.sort() + + // Clear any hash fragment from the URL. + url.hash = '' + + // Return the normalized URL as a string. + return url.toString() +} + export const isValidUrl = (url: string) => { try { new URL(url) @@ -20,3 +68,25 @@ export const isReachable = async (url: string) => { return false } } + +/** + * Extracts a filename from a given URL. + * + * @param url - The URL from which to extract the filename. + * @returns The filename extracted from the URL. If no filename can be extracted, a default name is provided. + */ +export const getFilenameFromUrl = (url: string): string => { + // Create a URL object to parse the provided URL string + const urlObj = new URL(url) + + // Extract the pathname from the URL object + const pathname = urlObj.pathname + + // Extract the filename from the pathname. The filename is the last segment after the last '/' + // If pathname is empty or does not end with a filename, use 'downloaded_file' as the default + const filename = + pathname.substring(pathname.lastIndexOf('/') + 1) || 'downloaded_file' + + // Return the extracted filename + return filename +} diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 504d101..96b45ee 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -34,3 +34,36 @@ export const timeout = (ms: number = 60000) => { }, ms) // Timeout duration in milliseconds }) } + +/** + * Copies the given text to the clipboard. + * + * @param text - The text to be copied to the clipboard. + * @returns A promise that resolves to a boolean indicating success or failure. + */ +export const copyTextToClipboard = async (text: string): Promise => { + try { + // Check if the Clipboard API is available + if (navigator.clipboard) { + // Use the Clipboard API to write the text to the clipboard + await navigator.clipboard.writeText(text) + return true // Successfully copied + } else { + // Clipboard API is not available, fall back to a manual method + const textarea = document.createElement('textarea') + textarea.value = text + // Ensure the textarea is not visible to the user + textarea.style.position = 'absolute' + textarea.style.left = '-9999px' + document.body.appendChild(textarea) + textarea.select() + // Attempt to copy the text to the clipboard + const successful = document.execCommand('copy') + document.body.removeChild(textarea) + return successful + } + } catch (error) { + console.error('Failed to copy text to clipboard', error) + return false // Failed to copy + } +} diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 3e09383..a399374 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -2,6 +2,7 @@ interface ImportMetaEnv { readonly VITE_APP_RELAY: string + readonly VITE_ADMIN_NPUBS: string // more env variables... }