Skip to content

Commit 85411eb

Browse files
committed
Loading tabs for today
1 parent f4ec75f commit 85411eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Tab } from "../entity/tab";
2-
import Browser from 'webextension-polyfill';
32

43
export interface ITabsRepository {
54
getTabs(): Tab[];
5+
getTodayTabs(): Tab[];
66
getTab(domain:string): Tab | undefined;
77
addTab(domain: string, favicon: string | undefined): Promise<Tab | undefined>;
88
}

src/repository/tabs-repository.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Tab } from "../entity/tab";
33
import { injecStorage } from "../storage/inject-storage";
44
import { isInBlackList } from "../compositions/black-list";
55
import { StorageDeserializeParam } from "../storage/storage-params";
6+
import { todayLocalDate } from "../utils/today";
67

78
export class TabsRepository implements ITabsRepository {
89
private tabs: Tab[];
@@ -21,6 +22,10 @@ export class TabsRepository implements ITabsRepository {
2122
return this.tabs;
2223
}
2324

25+
getTodayTabs(): Tab[]{
26+
return this.tabs.filter(x => x.days.find(s => s.date === todayLocalDate()));
27+
}
28+
2429
getTab(domain: string): Tab | undefined {
2530
return this.tabs?.find((x) => x.url === domain);
2631
}

0 commit comments

Comments
 (0)