Commit graph

9753 commits

Author SHA1 Message Date
Manav Rathi
85aaf1d27e Deduce type from values
It is indeed possible to have a TypeScript type and an array of all of its
possible values without repeating ourselves.

The trick is - while we cannot go from types to values, we can go the other way
around. The sidetrick is - typeof array[number] gives us type of an array's
elements.

Combined, we get this pattern

    const fruits = ["banana", "orange"] as const;
    type Fruits = (typeof fruits)[number];

Refs:
- https://stackoverflow.com/questions/53154564/how-to-get-all-possible-values-of-a-union-type-to-an-array-or-the-other-way-aro
- https://www.typescriptlang.org/docs/handbook/2/indexed-access-types.html
2024-02-23 10:25:58 +05:30
Manav Rathi
1c2f7a4ba3 Document 2/3 2024-02-23 09:59:29 +05:30
Manav Rathi
fd3341f699 Move to ui package 2024-02-23 09:41:42 +05:30
Manav Rathi
f620ace655 Remove storage dependency 2024-02-22 23:01:51 +05:30
Manav Rathi
057be016d3 Consolidate into single file 2024-02-22 22:54:17 +05:30
Manav Rathi
3febb2f749
Further package cleanup and rearranging (#1649) 2024-02-22 22:50:02 +05:30
Manav Rathi
7441883a9c Move the UI dependencies down to the ui package from the top level 2024-02-22 21:52:08 +05:30
Manav Rathi
4be92369fd Shorten 2024-02-22 20:47:41 +05:30
Manav Rathi
59326ec331 Allow inter package importing
The transpilePackage affordance provided by Next.js only kicks in when we import
our TypeScript packages into the apps. But when importing them into another
(internal) package within our monorepo, the transpilation doesn't happen, so
VSCode (rightfully) complains.

It works out fine at runtime (since the actual app code will transpile it
correctly), but this is not a good DX, and smells hacky. So for now, we avoid
our dependence on the export map by keeping the hierarchy rooted at root.
2024-02-22 20:42:45 +05:30
Manav Rathi
6018806e23 Move isDevBuild to new package 2024-02-22 20:15:43 +05:30
Manav Rathi
c82342b7ae Add transpilation for the ui package 2024-02-22 15:50:45 +05:30
Manav Rathi
cdf55f5263
Create separate UI package (#1647) 2024-02-22 15:48:01 +05:30
Manav Rathi
eb5bea305b One line hello
Makes it easier to find these lines, especially when running as the renderer process in the desktop app
2024-02-22 15:42:49 +05:30
Manav Rathi
abd0193aea Sync the plugin with the main next version 2024-02-22 15:18:00 +05:30
Manav Rathi
6e0606e5fc Remove another unused library 2024-02-22 15:15:07 +05:30
Manav Rathi
53d04dcf9c Remove unused package next-transpile-modules
yarn workspace photos remove next-transpile-modules
2024-02-22 15:07:25 +05:30
Manav Rathi
35d7f7dff8 Repin sentry cli version to workaround bug when using SENTRY_AUTH_TOKEN 2024-02-22 14:54:14 +05:30
Manav Rathi
a21836c3b9 Pin zip.js version to not deal with type errors
This code might anyways be replaced by ONNX
2024-02-22 13:06:00 +05:30
Manav Rathi
0cbc5144a0 Pin tflite to fix build errors 2024-02-22 13:00:23 +05:30
Manav Rathi
171d8a7ae0 Ignore some type errors 2024-02-22 12:51:14 +05:30
Manav Rathi
aabdab1a13 Add shortcuts 2024-02-22 12:22:07 +05:30
Manav Rathi
46720e8fcd Update mui 2024-02-22 12:17:27 +05:30
Manav Rathi
bac4601ccb Update types to match our React version 2024-02-22 12:14:19 +05:30
Manav Rathi
cfa630a620 Update to latest emotion
yarn upgrade "@emotion/react" "@emotion/server" "@emotion/styled" --latest

This is to pull in the bugfix for this issue:
https://github.com/emotion-js/emotion/issues/3049
2024-02-22 12:09:56 +05:30
Manav Rathi
d3dca2e7a9 Prettier the yamls too 2024-02-22 11:57:55 +05:30
Manav Rathi
183610c000 Prettier 3 uses .gitignore 2024-02-22 11:56:00 +05:30
Manav Rathi
c05d51c24f Add deprecation notices 2024-02-22 11:48:07 +05:30
Manav Rathi
bc3bb1714e yarn lint 2024-02-22 11:46:24 +05:30
Manav Rathi
f1cf014004 Update to Prettier 3 2024-02-22 11:41:13 +05:30
Manav Rathi
44703ff3df Use the strict variant of recommended configs
Ref: https://typescript-eslint.io/users/configs/
2024-02-22 11:31:14 +05:30
Manav Rathi
a00f64eaa9 Share the eslint config 2024-02-22 11:25:04 +05:30
Manav Rathi
199d322939 Reuse tsconfig
Ref: https://github.com/tsconfig/bases/tree/main/template
2024-02-22 10:50:54 +05:30
Manav Rathi
fb1dccc7db Create separate UI package 2024-02-22 10:28:00 +05:30
Manav Rathi
d0da1ce439 Add supporting functions 2024-02-22 10:02:29 +05:30
Manav Rathi
f3be0d6604 Show i18n debug output on dev builds 2024-02-22 10:02:29 +05:30
Manav Rathi
fee2b81568 Fix typos 2024-02-22 10:02:29 +05:30
Manav Rathi
b213796628 Add some docs 2024-02-22 10:02:29 +05:30
Manav Rathi
d152f08382
Remove the need for nested child selectors to workaround emotional (sic) issues (#1646) 2024-02-22 09:57:07 +05:30
Manav Rathi
b3ad2dc9ed Remove the need for nested child selectors to workaround emotional (sic) issues
This workaround was added in https://github.com/ente-io/photos-web/pull/1027,
but it has stopped working again, likely due to the update to Next 14. We're
only using nested child selectors in one place (not 100% sure of this, but I did
try to poke around and verify that statement a bit).

This was causing an error in dev mode, and silent failure in production mode.

- Hover state is restored
- dev mode seems to work fine
- yarn build also works
2024-02-22 09:51:31 +05:30
Manav Rathi
6dd6af3eb1
Fix yarn workspace photos add foo (#1645) 2024-02-21 21:25:13 +05:30
Manav Rathi
dd6d599150 Temporarily turn off some newly added warnings to allow lint to pass
These were introduced since we updated the eslint-package version.
2024-02-21 21:19:36 +05:30
Manav Rathi
c9bb6d443b Fix yarn workspace photos add foo
This was likely happening because the package versions in the top level
package.json and the eslint-config package.json were different. I've synced them
for now.

> On a longer time frame, the idea is not have such conflicting cases, and
remove mostly all the top level package.json dependencies and for the rest rely
on them solely being in the top level package.json and not duplicated in two
places.
2024-02-21 21:12:11 +05:30
Manav Rathi
5e2470f957
docs: Mention need to yarn install (#1644) 2024-02-21 17:20:52 +05:30
Manav Rathi
ee4cd922e4 Mention both dev and build 2024-02-21 17:20:09 +05:30
Manav Rathi
8def9d548c Mention need to yarn install 2024-02-21 17:18:55 +05:30
Manav Rathi
7cd6b8cad9
docs: Mention aliases (#1643) 2024-02-21 17:12:59 +05:30
Manav Rathi
b925ba273b docs: Mention aliases 2024-02-21 17:12:31 +05:30
Manav Rathi
ddc5076201
Update Sentry DSNs (#1642) 2024-02-21 14:07:16 +05:30
Manav Rathi
51869969e4 Also update project names (needed for sourcemap uploads) 2024-02-21 14:01:43 +05:30
Manav Rathi
164ee70943 Update Sentry DSNs 2024-02-21 13:53:49 +05:30