feat: mode switch with OS preference
#14Add light switch component to layout, which is initialized to OS preference. @FelixNgFender @chezzijr
This PR was not deployed automatically as @Harrelix does not have access to the Railway project.
In order to get automatic PR deploys, please add @Harrelix to the project inside the project settings page.
It's weird that there is an error when linting, here is the log on my machine. Everything else works fine though. Could you guys also try? @Harrelix @chezzijr
felixng@FelixLegion:~/repos/look-for-party-frontend$ npm run lint
> look-for-party-frontend@0.0.1 lint
> prettier --plugin-search-dir . --check . && eslint .
Checking formatting...
All matched files use Prettier code style!
/home/felixng/repos/look-for-party-frontend/src/routes/+layout.svelte
7:18 error Parsing error: Unexpected keyword or identifier
✖ 1 problem (1 error, 0 warnings)
@FelixNgFender Suspect it's something to do with line endings. After https://github.com/FelixNgFender/look-for-party-frontend/pull/14/commits/032eb6a3d5391215bd512313a17c77128eb4148c src/routes/+layout.svelte
is the only one with LF.
$ git ls-files --eol
i/lf w/crlf attr/ .eslintignore
i/lf w/crlf attr/ .eslintrc.cjs
i/lf w/crlf attr/ .gitignore
i/lf w/crlf attr/ .npmrc
i/lf w/crlf attr/ .prettierignore
i/lf w/crlf attr/ .prettierrc
i/lf w/crlf attr/ README.md
i/lf w/crlf attr/ package-lock.json
i/lf w/crlf attr/ package.json
i/lf w/crlf attr/ playwright.config.ts
i/lf w/crlf attr/ postcss.config.cjs
i/lf w/crlf attr/ src/app.d.ts
i/lf w/crlf attr/ src/app.html
i/lf w/crlf attr/ src/app.postcss
i/lf w/crlf attr/ src/index.test.ts
i/lf w/crlf attr/ src/lib/components/layout.svelte
i/lf w/crlf attr/ src/lib/index.ts
i/lf w/lf attr/ src/routes/+layout.svelte
i/lf w/crlf attr/ src/routes/+page.svelte
i/-text w/-text attr/ static/favicon.png
i/lf w/crlf attr/ svelte.config.js
i/lf w/crlf attr/ tailwind.config.ts
i/lf w/crlf attr/ tests/test.ts
i/lf w/crlf attr/ tsconfig.json
i/lf w/crlf attr/ vite.config.ts
@Harrelix Here is the same command on my machine.
$ git ls-files --eol
i/lf w/lf attr/ .eslintignore
i/lf w/lf attr/ .eslintrc.cjs
i/lf w/lf attr/ .gitignore
i/lf w/lf attr/ .npmrc
i/lf w/lf attr/ .prettierignore
i/lf w/lf attr/ .prettierrc
i/lf w/lf attr/ README.md
i/lf w/lf attr/ package-lock.json
i/lf w/lf attr/ package.json
i/lf w/lf attr/ playwright.config.ts
i/lf w/lf attr/ postcss.config.cjs
i/lf w/lf attr/ src/app.d.ts
i/lf w/lf attr/ src/app.html
i/lf w/lf attr/ src/app.postcss
i/lf w/lf attr/ src/index.test.ts
i/lf w/lf attr/ src/lib/components/layout.svelte
i/lf w/lf attr/ src/lib/index.ts
i/lf w/lf attr/ src/routes/+layout.svelte
i/lf w/lf attr/ src/routes/+page.svelte
i/-text w/-text attr/ static/favicon.png
i/lf w/lf attr/ svelte.config.js
i/lf w/lf attr/ tailwind.config.ts
i/lf w/lf attr/ tests/test.ts
i/lf w/lf attr/ tsconfig.json
i/lf w/lf attr/ vite.config.ts
This is likely a parser error, see this issue I suggest setting a default mode instead of using OS preference, or you could simply follow the workaround in the above link
Shouldn't use autoModeWatcher along with Lightswitch component (https://www.skeleton.dev/utilities/lightswitches). Using setModeCurrent and getModeOsPrefers instead.