Commit graph

41 commits

Author SHA1 Message Date
Henrik Giesel
630ee9c6bb Use graphs-base and congrats-base 2021-04-13 19:47:03 +02:00
Damien Elmes
eb6502bd6e add missing copyright headers to *.svelte 2021-04-13 19:02:41 +10:00
Damien Elmes
43a8b8fec3 stop Svelte warnings from failing the build
+ check for them at test time
2021-04-12 14:28:09 +10:00
Damien Elmes
00eb89c2ec use singleton + free functions for i18n in ts
This allows for tree shaking, and reduces the congrats page from 150k
with the old enum solution to about 80k.
2021-03-26 20:38:44 +10:00
Henrik Giesel
8cb7d4a8ad Create search and days writable in GraphsPage to allow browserSearch to work 2021-03-22 02:44:08 +01:00
Henrik Giesel
1e5bb2f226 Create BrowserSearch component, because we cannot read from stores within slotted content 2021-03-22 01:42:23 +01:00
Henrik Giesel
abdf8a464f Remove pending, and resort to checking for value
- once value is set, it won't be unset
2021-03-22 01:42:23 +01:00
Henrik Giesel
fbf2c6f6fc Rename search and days to initialSearch and intitialDays in GraphsPage 2021-03-22 01:42:23 +01:00
Henrik Giesel
4ef0b3c977 Get it to work, if you change the input
- there's still an issue on initial load
2021-03-22 01:42:23 +01:00
Henrik Giesel
26d4854502 Compiles with WithGraphData 2021-03-22 01:42:23 +01:00
Henrik Giesel
c6ba8f779e Move Graph-specific html from GraphsPage to Graph.svelte 2021-03-22 01:42:21 +01:00
Damien Elmes
7c76693618 merge in Henrik's TS/Svelte refactor with some changes
- The previous commits moved the majority of the remaining global css
into components; move the remaining @emotion/css references into
ticks.scss and the styling of the Graph.svelte. This is not as elegant
as the emotion solution, but builds a whole lot faster, and most of
our styling can be scoped to a component anyway.
- Leave the .html files in ts/ for now. AnkiMobile uses them, and
AnkiDroid likely will in the future too. In the long run we'll likely
move to loading the JS into an existing page instead of loading a
separate page, but at that point we can just exclude the .html file from
copy_files_into_group() without affecting other clients.

Closes #1074
2021-03-21 23:01:18 +10:00
Damien Elmes
c02823b488 bundle all Svelte css into separate file
- svelte compilation outputs a separate .css file for each component
- compilation also adds an "import foo.css" to the top of each generated
.mjs file
- when the .mjs files are bundled into app.js, esbuild creates an app.css
as well
- graphs.scss was renamed to graphs_shared.scss and imported in the
top level GraphsPage. Henrik's style refactoring would be a better path
forward, but I needed to make this change for now, as the filenames were
conflicting.
2021-03-21 16:06:36 +10:00
Damien Elmes
45ec14184a show actual error when graphData fails
The original reason for the catch-all message was users with bad
data such as decimal intervals, but those get automatically coerced
these days. The common case should now be invalid search strings, which
we can show verbatim.
2021-01-29 14:39:05 +10:00
Henrik Giesel
45ff094392 Add bridgeCommand helper function 2021-01-26 01:25:54 +01:00
Henrik Giesel
76691176f6 Add a working example of searching from the stats screen in the Card Counts 2021-01-25 13:46:42 +01:00
Henrik Giesel
cee2f396da Add search event listeners on graphs 2021-01-25 13:45:42 +01:00
Henrik Giesel
f8c590c914 Fix RangeBox RevlogRange defaulting to All instead of Year 2021-01-23 13:57:43 +01:00
Henrik Giesel
15bd2e74f8 Hook up cardCountsSeparateInactive to PreferenceStore 2021-01-22 13:14:35 +01:00
Henrik Giesel
5ee3e0d0d7 Add PreferenceStore with gettable/settable preferences
* setting is not yet hooked up to rslib
2021-01-22 13:14:33 +01:00
Henrik Giesel
1516f5c37e Add GraphsPreferences endpoint to backend 2021-01-22 13:13:48 +01:00
Damien Elmes
f42e62aca6 controller should be marked nullable
While 'SvelteComponent | null' seems to make it into the .tsx file
created by svelte2tsx, the subsequent tsc call seems to discard the
'| null' part when creating the .d.ts file. Hack around it with a cast
for now; this may be fixed if we move to ts_project in the future.
2020-12-29 15:21:46 +10:00
Damien Elmes
8388b1d838 use local strategy for Svelte on CI
Allows some type errors to surface that were only being picked up
on Windows.

The root cause seems to be TypeScript picking up other .d.ts/.tsx
files in the same folder, which it can only do on Windows due to the
lack of sandboxing. On other platforms the other files can't be found,
and tsc changes the types into 'any'.

I experimented with modifying rules_svelte to build all .tsx files up
front and convert them to .d.ts in bulk, but ran into further issues
with conflicting types, as the typings in svelte2tsx seem to conflict
with Svelte's built-in types, and passing the dependencies in explicitly
causes them to be checked even though --skipLibCheck is passed in to
TypeScript.

Forcing sandboxing off is an ugly hack, and our best approach moving
forward may be to switch to ts_project for the Svelte generation -
it does appear that rules_nodejs favours it over ts_library anyway.
2020-12-29 14:50:33 +10:00
Henrik Giesel
71149656fc Fix typo 2020-12-27 02:04:45 +01:00
Henrik Giesel
20c2d55059 Fix formatting 2020-12-26 18:24:24 +01:00
Henrik Giesel
f9229be1ff Pass in RangeBox as an argument, decoupling it from GraphsPage 2020-12-26 14:40:55 +01:00
Henrik Giesel
4309b6f7a5 Fix displaying issue with active spinner 2020-12-26 00:16:54 +01:00
Henrik Giesel
1b4fd39d70 Make Year/All display correctly 2020-12-26 00:08:24 +01:00
Henrik Giesel
4f28750dff Move spinner back to RangeBox 2020-12-25 22:59:11 +01:00
Henrik Giesel
13acbe131c Put RangeBox into its own component 2020-12-25 22:29:42 +01:00
Henrik Giesel
3373cf7ad0 Make spinner's position sticky in relation to graphsContainer 2020-12-25 21:49:56 +01:00
Henrik Giesel
2362ba36d8 Put a transition:fade on the spinner 2020-12-25 20:11:46 +01:00
Henrik Giesel
73c17f9abd Remove .active class from .spin 2020-12-25 20:07:52 +01:00
Henrik Giesel
ee0bbd8fda Turn async function into svelte statement 2020-12-23 16:45:00 +01:00
Henrik Giesel
fa5e2407f3 Making days settable does not make sense, as it will be overwritten 2020-12-23 16:20:12 +01:00
Henrik Giesel
ef7f2ba2a6 Move infile to css to scss file 2020-12-22 22:39:22 +01:00
Henrik Giesel
0967308e53 Make showing of rangeBox based on parameter 2020-12-22 22:36:39 +01:00
Henrik Giesel
d5e9ce4b1d Bubble up days and search to caller 2020-12-22 22:25:47 +01:00
Henrik Giesel
9f8a9ad540 Pass in graphs as arguments into graphs() 2020-12-22 22:09:23 +01:00
Damien Elmes
4f8b19dcfb fix external consumption of ts rules, and simplify import path 2020-11-05 11:01:52 +10:00
Damien Elmes
ce3b08ac58 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
Renamed from ts/src/stats/GraphsPage.svelte (Browse further)