Commit Graph
54 Commits
Author SHA1 Message Date
Sasha SorokinandEvan Song b3a6393c91 Add TypeScript to app-frontend (#2364)
* Add TypeScript to app-frontend

Co-authored-by: Evan Song <52982404+ferothefox@users.noreply.github.com>

* Switch app-frontend to ESLint 9 & Nuxt config

* Fix ESLint issues after config change in app-frontend

---------

Co-authored-by: Evan Song <52982404+ferothefox@users.noreply.github.com>
2024-09-07 23:40:40 -07:00
Sasha Sorokin 50734af6cd Fix Game versions input not showing (#2358)
There is a bug in vue-multiselect library where it will default
`custom-label` property to raw properies object. Presumably this is a
bug that appeared because they ported library to Vue 3 and have not
considered that the signature for `default` prop's function has changed.

To work around this, we can provide custom `custom-label` property that
is just a function that returns the input itself. In other places, where
objects are passed, `label` property can be used. In this case the first
suggestion applies. DO NOT USE VUE-MULTISELECT WITOUT `LABEL` OR
`CUSTOM-LABEL` PROPS!
2024-09-03 16:44:21 +00:00
Sasha Sorokin e0990910f6 Remove shift caused by the Exclude filter button (#2265)
Previously, the Exclude button was removed from the the element tree
entirely until the group is hovered. Only when the group is hovered, the
button element was being switched to a proper display form. This has
caused the layout shift which was very visible when quickly moving
cursor over the filter options.

This commit makes it so that the Exclude button is always in its proper
display form (flex), however is transparent until the group is hovered.
The repeated transparency classes were removed from the icon as well to
prevent jarringly-looking double transition.
2024-08-22 18:17:59 -07:00
Sasha SorokinandGeometrically 4fcd518b0a Replace useAutoRef with Vue's toRef (#1332)
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-07-31 19:44:48 +00:00
Sasha SorokinandGeometrically 1e0d7c7e28 Rewrite cosmetics and theme preferences (#1328)
- Cosmetics and theme preferences are now only stored in cookies instead
  of a combination of both cookies and state.

- The theme plugin now supports client hints. This allows the server
  to render a page using the client-preferred theme provided it supplies
  this information (any browser other than Firefox), helping to avoid an
  annoying flash while the page is hydrating.

- For the future, the theme plugin now supports additional light themes.
  Light theme preferences are currently not stored, but this can easily
  be fixed if the need arises.

- The previous workaround using the Nitro plugin has been removed. Its
  functionality is now handled by the Nuxt theme plugin with cleaner
  code.

- All pages and components now use the new plugins.

- Compared to the previous attempt, this commit has been improved to be
  more robust in cases where the theme cookie contains invalid values.

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-07-31 19:42:55 +00:00
Sasha SorokinandGeometrically ba9dc6ce26 Fix auth redirect URL being double encoded (#1280)
Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-07-20 00:24:35 +00:00
Sasha Sorokin 8704d3acb3 Rewrite cosmetics and theme preferences (#1292)
- Cosmetics and theme preferences are now only stored in cookies instead
  of a combination of both cookies and state.

- The theme plugin now supports client hints. This allows the server
  to render a page using the client-preferred theme provided it supplies
  this information (any browser other than Firefox), helping to avoid an
  annoying flash while the page is hydrating.

- The previous workaround using the Nitro plugin has been removed. Its
  functionality is now handled by the Nuxt theme plugin with cleaner
  code.

- All pages and components now use the new plugins.
2024-07-13 19:20:43 +00:00
Sasha SorokinandGeometrically ce4250281f Refactor auth middleware (#1279)
- Switch to TypeScript
- Use early return
- Switch to regular for loop

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
2024-07-11 19:02:00 +00:00
Sasha Sorokin aecbc714c4 Update @vintl/nuxt to ^1.9.2 (#1286)
This fixes the issue where types for NuxtApp would be incorrect due to
the incorrect Plugin return type by @vintl/nuxt.
2024-07-11 18:58:18 +00:00
Sasha Sorokin b6618f81f8 Fix transition covering More download options btn (#1736)
This pushes bottom transition to a background level while setting it so
that any z-indexes are isolated within the hero to avoid any other
weirdness from happenning.
2024-07-02 22:05:27 -07:00
Sasha Sorokin bd49d6bd89 Inject native router only in reactive scopes (#1730) 2024-06-15 08:27:38 -04:00
Sasha Sorokin 61fd6f1741 Fix Turnstile unable to read the siteKey (#1728)
It seems that Nuxt Turnstile's way of setting the key in `runtimeConfig`
is broken and doesn't work properly, resulting in an error in runtime,
because it has to be set. This commit sets the key in `runtimeConfig`
manually instead, which seems to fix the issue.
2024-06-14 23:26:45 -04:00
Sasha Sorokin e0a9e62d84 Fix building for Cloudflare Nitro preset (#1726)
It seems that Rollup node-resolve module doesn't properly deal with
trailing slashes, causing it to thing that `string_decoder` is a
built-in Node.js dependency and attempt to import it from `unenv`, which
will obviously fail, because `string_decoder` is not, in fact, a Node.js
dependency, but an individual dependency of `readable-stream`.

This adds a small patch for `readable-stream@2.3.8` dependency, which
removes the leading slash, which seems to fix the builds.

This probably should be reported to relevant developers (Rollup
node-resolve plugin or Nitro?).
2024-06-14 15:26:12 -07:00
Sasha Sorokin 5db5f2251f Fix bad if condition on languages page (#1721) 2024-06-14 15:21:22 -07:00
Sasha Sorokin 34fd9d29c8 Update Nuxt to v3.12.1 (#1720)
* Update Nuxt dependencies

* Fix ref access in ChartDisplay

* Fix feature flags cookie options type error

* Specify type-only imports

* Fix shorthands access to tags outside of reactive scope

* Replace most useRoute calls with useRoute from vue-router

Nuxt's version of this composable is horrendously broken (nuxt/nuxt#21340)

* Import all svgs with ?component parameter

Fixes weird hydration issues + gives correct type
2024-06-14 13:23:02 -07:00
Sasha Sorokin c6d8476963 Update pnpm to v9.3.0 (#1684) 2024-06-13 11:13:26 -07:00
Sasha Sorokin e1a748016a Prompt users to provide debug info to support (#1172)
Many people contacting support forget to provide the debug information,
which significantly delays the resolution time because we're forced to
ask for this information anyway, as without it we cannot tell with
certainty the issue the person is facing.

Ideally in the future it would probably make sense to give a link to the
article describing the common issues for self-help, but there's no such
article yet. Perseus however is able to give suggestion for a few issues
given that it has the debug information.
2024-05-09 10:25:21 -07:00
Sasha Sorokin 4de64d9a43 Further auth requests consistency fixes (#1149)
* Further auth requests consistency fixes

- Generated device UUIDs are lowercase, whereas they're uppercase in MCL
- TitleId in SISU authenticate is supposed to be a string (it is in MCL)
- UseModernGamertag in SISU authorize, on the other hand, is a boolean
- Clarified charset of our requests like MCL does
- Specified rng gen call to generate u8 to fix compile error (???)

* Enable deflate, gzip and brotli compression support
2024-04-25 11:45:32 -07:00
Sasha Sorokin fe3e4edb04 Fix removing oneself from the team not working (#1657) 2024-03-10 13:03:35 -07:00
Sasha Sorokin 35c9338220 Fix no collections message on user page (#1501) 2024-01-07 14:32:05 -05:00
Sasha Sorokin b453e2cf1a Fallback to project type message on unknown types (#1470)
This commit adds a fallback to getProjectTypeMessage function to return
a generic project type whenever it encounters an unknown project type,
ensuring there are no errors when the new project types are added.
2023-12-05 18:21:14 -07:00
Sasha Sorokin 6d70ced93a Add Omorphia locale files loading (#1447)
Implements loading of all locale files shipped with Omorphia package by
globbing and registering them during the `vintl:extendOptions` hook.

Also updated VIntl for Nuxt to ensure those files are properly loaded.
Previous version of VIntl for Nuxt had a somewhat broken module ID
tracking, preventing Omorphia locale files to be properly transformed
during the build; at least on systems like Windows, don't know about
*nix. The tracking approach was replaced in 1.8.0, and it seems to be
working now.
2023-12-04 19:48:12 -07:00
Sasha Sorokin 5051ad91ff Fix ambiguous default export (#113)
Currently Omorphia's index file has both the default and named exports.
While this is totally supported by native ESM, it's pretty hard for
transpilers to process and may lead to situations where named exports
cannot be imported directly, requiring destructuring on the default
import. For this and just consistency reasons, you'd usually avoid
mixing default and named exports.

This commit removes the default export, making it just an another named
export called `plugin`.

BREAKING CHANGE: plugin is now exported using `plugin` export, rather
than the default export.
2023-11-13 13:36:07 -07:00
Sasha Sorokin 82f0bdfc18 Add handling for locale files parsing errors (#1408) 2023-11-12 11:49:05 -05:00
Sasha Sorokin 591ce0894e Add translations support (#116) 2023-11-11 17:03:58 -05:00
Sasha Sorokin ca54544b82 Fix declaration types for icons (#114) 2023-11-11 16:32:56 -05:00
Sasha Sorokin 9c3ff71ce4 Make Omorphia an ESM-only module (#115) 2023-11-11 16:22:00 -05:00
Sasha Sorokin 9932fe5055 Fix relativeTime dayjs plugin import (#111) 2023-10-20 23:34:02 -04:00
Sasha Sorokin cb32cca6aa Enable TypeScript support
This commit enables TypeScript support in Omorphia. It reconfigures
Vite, adds two new TSConfig files as a replacement for the old JSConfig,
adds TypeScript linting to ESLint configuration.

Why?
====

TypeScript has became a standard in modern web development. In makes
JavaScript a more type-safe language, makes code more maintaible and
boosts effeciency by empowering development tools.

What's included in this commit?
===============================

TypeScript config files
-----------------------

Old and plain JSConfig has been replaced with two TSConfigs: one
designed for the code, and the other for the Vite configuration file.

JavaScript support is still enabled, therefore TypeScript files can
import JavaScript files as well, and vice versa. However, it is
recommended that all the new files will be written in TypeScript, and
old files are slowly converted over to TypeScript, so this option can be
disabled in the future, making this a safe TypeScript only project.

UMD output is replaced with CJS
-------------------------------

UMD is an old format that tries to stay compatible with both the Node.js
CJS, as well as Require.js. However, nowadays almost everyone is using a
transpiler where this format won't be beneficial.

To avoid it being a breaking change, it has been replaced with CJS. But
in the future it's worth considering removing CJS output as well and
making Omorphia an ESM module only, as it's designed only to be
consumed by the Modrinth project, and all of these projects are already
ESM-first.

Minification is disabled
------------------------

Because this is a library, the responsibility of minifying its code lies
solely on the consumer. Just like with CJS, all of the supported
consumers of this library are already performing minification, so
minifying this library beforehand is rather wasteful and harmful, as it
negatively impacts debugging experience.

More dependencies are now externalised
--------------------------------------

Disabling UMD output allows more easily externalise dependencies based
on the package.json file, making it way more approachable.

Vue is now a peer dependency
----------------------------

Because this is a component library, Vue is not a direct dependency of
this project. Instead, this library relies on consumer having a Vue as
its dependency.

`lib` is no longer included in package
--------------------------------------

`lib` folder contains sources for the imports, but it's outside of
export map and cannot be imported by the consumers. It is now excluded
from the package to reduce the package size and installation time.

Typings
-------

Consumers of this library should also be able to benefit from the type
safety. To achieve this, there's now a Vite plugin that generates type
declarations that represent the project structure.

To lesser the incompatibility with the consumers, some of the files were
changed to import `index.js` from folders rather than folders
themselves.

While both will work for building, not doing this requires consumer to
opt in to bundler module dependency, whereas if `index.js` is imported,
the consumer can use both the normal ESM / Node16 module resolution, as
well as the bundler module resolution.

ESLint configuration changes
----------------------------

ESLint has been reconfigured to support TypeScript, and include rules
recommended by the TypeScript ESLint package. In the future it would be
good to review the rules and override rules for TypeScript files to
disable rules that would conflict with ones from TypeScript ESLint.

Entry file is now a TypeScript file
-----------------------------------

To test the changes and begin the slow conversion, the entry point file
is now a proper TypeScript file.

SVG imports use `?component` parameter
--------------------------------------

All components are now imported with `?component` URL parameter so that
they have a proper file. By default, Vite imports all files like .svg
as strings containing path to the file.

Unfortunately, `vite-svg-loader` overrides this behaviour without
overriding the Vite import type declaration, leading to incorrect types.
However, it does expose a new parameter `?component`, which is properly
typed and does the same thing you'd expect - export a Vue component, so
most of the SVG imports have been converted to use this parameter.
2023-10-14 15:43:57 +02:00
Sasha Sorokin 5c7dd10769 Preserve whitespace in extracted translatable strings (#1390) 2023-10-01 15:45:21 -04:00
Sasha Sorokin f259072136 Post translation Sessions settings page fixes (#1382) 2023-09-30 14:47:26 -04:00
Sasha Sorokin 3fd74292ef Remove unnecessary space in description on Sessions settings page (#1381) 2023-09-28 23:53:44 -04:00
Sasha Sorokin bd4da4f365 Improve i18n-related SEO (#1366) 2023-09-16 21:07:52 -04:00
Sasha Sorokin 799d8003eb Skip regenerate workflow on forks (#1344) 2023-09-02 09:38:27 -04:00
Sasha Sorokin 5d34af6ac5 Make language label not translatable (#1343) 2023-09-02 09:38:10 -04:00
Sasha Sorokin 51b07fc0c3 Add names of all languages on Crowdin (#1337) 2023-08-23 16:07:37 -04:00
Sasha Sorokin d8f33641a5 Enable all locales on staging instances (#1336) 2023-08-23 15:18:58 -04:00
Sasha Sorokin 40cb8db1fc Move language nav menu item and hide it on prod (#1329) 2023-08-23 10:26:02 -04:00
Sasha Sorokin 467b0fa988 Add the language setting page (#1210)
* Add initial language picker prototype

* Heap o' improvements and Pirate tongue

* Move .visually-hidden to shared utils and add copyright notice

* Add a little space before categories names

* Simplify search to input focus logic

* Remove larger font size and padding from the search field

* Some refactors

* Braw's descent into madness

Thanks web development!

In seriousness though, tried to make the list more accessible. Making it
fully accessible feels like unbearable task, so at least that.

* Litol refactoring

* Extract new strings and remove old ones

* Update @vintl/nuxt to 1.3.0

This fixes the bug where default locale won't be saved.

* A buncha refactorings and cleanup

* Scuttle the Pirate lingo

'Twas employed 'ere for testin' purposes, but fear not, for it shall be
returnin' in the days to come. Should ye require it fer testin', simply
roll back this here commit.

* Clean languages source file

* Change "US" to "United States"

I think it would make distinguishing two languages simpler as now
there's more than one letter of difference (US/UK vs United States/
United Kingdom).
2023-08-21 13:26:39 -04:00
Sasha Sorokin eac029aef4 Webhook emojis update (#685) 2023-08-20 16:33:36 -04:00
Sasha Sorokin 7c2ea3dcfd Don't run Deploy workflow on forks (#1252) 2023-08-01 19:38:47 -04:00
Sasha Sorokin c8c75b38c3 Update @vintl/nuxt to 1.2.3 (#1201)
This should fix TypeScript error related to nuxt.config.ts file and
unknown `vintl` property in it.
2023-06-15 12:24:12 -07:00
Sasha Sorokin de991041c4 Add internationalization support (#738) 2023-06-11 14:08:16 -04:00
Sasha Sorokin d9f8746438 Consistent extension usage in imports (#1171) 2023-06-11 13:37:40 -04:00
Sasha Sorokin 20d1c4d242 Switch to bundler TypeScript moduleResolution (#1170) 2023-06-11 13:33:38 -04:00
Sasha Sorokin 3b0dc2195d Switch to pnpm (#1168) 2023-05-28 14:21:14 -04:00
Sasha Sorokin d68bbbf9a1 GitHub Actions: Use Node 16 to build Knossos (#913) 2023-01-18 19:39:53 -05:00
Sasha Sorokin de170ebdd2 Fix notifications fetching (#776) 2022-11-26 17:40:15 -05:00
Sasha Sorokin 95ac136720 Bump Vue to 2.7 (#727)
List of changes in Vue 2.7:
https://blog.vuejs.org/posts/vue-2-7-naruto.html
2022-11-15 12:43:01 -07:00
Sasha Sorokin e86aa6b541 Fix project layout on right not working correctly (#730)
Fixes #726
2022-11-15 12:41:28 -07:00
Sasha Sorokin 1b49844012 Bump @nuxtjs/color-mode to v2.1.1 (#678) 2022-09-26 19:38:33 -04:00
Sasha Sorokin 5d53344b75 More reliably detect ad load faults (#661)
Detecting that ad has failed to load with timeout is not accurate and
won't work on slow connections. This commit fixes that by changing
detection to use 'onerror' event on <script> tag instead, which will be
triggered if ad script fails to load due to blocking.
2022-09-12 08:14:32 -07:00
Sasha Sorokin 3e221f3b6a Minor fixes for "See all" link design (#627)
- Now styled as a proper link.
- Change :focus to :focus-visible to avoid link getting stuck in that
  'hovered' state because focus does not actually change (it deffo
  should though, something to fix in the future - should be one
  fragment change).
- Removed all padding and transition.
2022-09-03 22:34:19 -07:00
Sasha Sorokin 8769b5d1b5 Improve design of "See all" link in feat. section (#625) 2022-08-24 13:30:57 -04:00