Skip to content

Commit 3e20139

Browse files
committed
[frontend] add app shortcuts to new tab page
1 parent 31e80de commit 3e20139

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

frontend/src/Tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class Tab extends StatefulClass {
7777
if (ctx.window == frame.frame.contentWindow) {
7878
injectTitleWatcher(ctx.client, this);
7979
injectHistoryEmulation(ctx.client, this);
80-
injectDevtools(ctx.client, this);
80+
// injectDevtools(ctx.client, this);
8181
}
8282
});
8383

frontend/src/pages/NewTabPage.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export const NewTabPage: Component<
2121
}}
2222
placeholder="Search Google or type A URL"
2323
></input>
24+
<div class="suggestions">
25+
{browser.globalhistory.slice(0, 5).map((entry) => (
26+
<div class="suggestion" on:click={() => browser.newTab()}>
27+
<div class="circle">
28+
<img src={entry.favicon || "/vite.svg"} alt="favicon" />
29+
</div>
30+
<span class="title">{entry.title || entry.url.href}</span>
31+
</div>
32+
))}
33+
</div>
2434
</div>
2535
</div>
2636
);
@@ -34,11 +44,41 @@ NewTabPage.style = css`
3444
font-family: sans-serif;
3545
}
3646
47+
.suggestions {
48+
width: 100%;
49+
50+
grid-template-columns: repeat(5, 1fr);
51+
grid-template-rows: repeat(2, 1fr);
52+
display: grid;
53+
}
54+
55+
.suggestion {
56+
display: flex;
57+
flex-direction: column;
58+
align-items: center;
59+
gap: 0.5em;
60+
}
61+
.circle {
62+
width: 64px;
63+
height: 64px;
64+
65+
border-radius: 50%;
66+
background-color: #f0f0f0;
67+
display: flex;
68+
justify-content: center;
69+
align-items: center;
70+
}
71+
.suggestion img {
72+
width: 32px;
73+
height: 32px;
74+
}
75+
3776
.main {
3877
width: 70%;
3978
display: flex;
4079
flex-direction: column;
4180
align-items: center;
81+
gap: 1em;
4282
}
4383
4484
input {

0 commit comments

Comments
 (0)