@shaxpir/duiduidui-models 1.9.11 → 1.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,6 +89,7 @@ export declare class Device extends Content {
89
89
  get currentSearchState(): SearchState | undefined;
90
90
  /**
91
91
  * Returns true if back navigation is possible.
92
+ * Only returns true if the previous entry is non-empty (has query or conditions).
92
93
  */
93
94
  get canGoBack(): boolean;
94
95
  /**
@@ -267,10 +267,16 @@ class Device extends Content_1.Content {
267
267
  }
268
268
  /**
269
269
  * Returns true if back navigation is possible.
270
+ * Only returns true if the previous entry is non-empty (has query or conditions).
270
271
  */
271
272
  get canGoBack() {
272
273
  this.checkDisposed("Device.canGoBack");
273
- return this.searchHistory.cursor > 0;
274
+ const history = this.searchHistory;
275
+ if (history.cursor <= 0)
276
+ return false;
277
+ // Check if the entry we'd navigate to is non-empty
278
+ const prevEntry = history.entries[history.cursor - 1];
279
+ return !(0, SearchState_1.isEmptySearchState)(prevEntry);
274
280
  }
275
281
  /**
276
282
  * Returns true if forward navigation is possible.
@@ -0,0 +1,40 @@
1
+ import { CompactDate } from "@shaxpir/shaxpir-common";
2
+ /**
3
+ * Activity data for a single day, used in activity calendars.
4
+ */
5
+ export interface DayActivity {
6
+ date: CompactDate;
7
+ reviews: number;
8
+ minutes: number;
9
+ }
10
+ /**
11
+ * Distribution of cards across proficiency grades.
12
+ * - A: Mastered (theta >= 0.8)
13
+ * - B: Good (0.6 <= theta < 0.8)
14
+ * - C: Learning (0.4 <= theta < 0.6)
15
+ * - D: Poor (0.2 <= theta < 0.4)
16
+ * - F: Not learned (theta < 0.2)
17
+ */
18
+ export interface GradeDistribution {
19
+ A: number;
20
+ B: number;
21
+ C: number;
22
+ D: number;
23
+ F: number;
24
+ }
25
+ /**
26
+ * Stats for a friend, returned by the GET /api/friends/:user_id/stats endpoint.
27
+ * Used to display a friend's learning progress in the FriendStatsModal.
28
+ */
29
+ export interface FriendStats {
30
+ skill_level: number;
31
+ skill_level_lower_bound: number;
32
+ skill_level_upper_bound: number;
33
+ cognitive_load: number;
34
+ total_reviews: number;
35
+ weekly_reviews: number;
36
+ current_streak: number;
37
+ longest_streak: number;
38
+ grade_distribution: GradeDistribution;
39
+ activity_data: DayActivity[];
40
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,7 @@ export * from './Content';
7
7
  export * from './ContentKind';
8
8
  export * from './Device';
9
9
  export * from './Flag';
10
+ export * from './FriendStats';
10
11
  export * from './GeoLocation';
11
12
  export * from './Hanzi';
12
13
  export * from './Manifest';
@@ -24,6 +24,7 @@ __exportStar(require("./Content"), exports);
24
24
  __exportStar(require("./ContentKind"), exports);
25
25
  __exportStar(require("./Device"), exports);
26
26
  __exportStar(require("./Flag"), exports);
27
+ __exportStar(require("./FriendStats"), exports);
27
28
  __exportStar(require("./GeoLocation"), exports);
28
29
  __exportStar(require("./Hanzi"), exports);
29
30
  __exportStar(require("./Manifest"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.9.11",
3
+ "version": "1.9.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"