Skip to content

Commit

Permalink
Treat tabs as links for web
Browse files Browse the repository at this point in the history
  • Loading branch information
lamasters committed Jul 5, 2024
1 parent 3f02024 commit e51731e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions entangled-web/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@

.tab-button {
text-decoration: underline;
color: white;
}

.tab-button:hover {
cursor: pointer;
text-decoration: dashed;
}

.tab-button:visited {
color: white;
}

#save-button {
position: absolute;
top: 10px;
Expand Down
14 changes: 6 additions & 8 deletions entangled-web/src/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ export function tabItem(tab, session, setTabs) {
>
X
</div>
<div
<a
className="tab-button"
onClick={() => {
deleteTab(tab, session, setTabs, true);
}}
href={tab.url}
target="_blank"
rel="noreferrer"
>
{title}
</div>
</a>
</div>
);
}
Expand All @@ -39,25 +42,20 @@ export async function getTabs(session, setTabs) {
}
}

export async function deleteTab(tab, session, setTabs, openTab) {
export async function deleteTab(tab, session, setTabs) {
try {
await session.database.deleteDocument(
APPWRITE_CONFIG.DATABASE_ID,
APPWRITE_CONFIG.BUCKET_ID,
tab.$id,
);
await getTabs(session, setTabs);
if (openTab)
setTimeout(() => {
window.open(tab.url, "_blank", "noopener,noreferrer");
}, 1);
} catch (e) {
console.error(e);
}
}

export async function addTab(session, user, url, setTabs) {
console.log("Adding tab: ", url);
try {
if (!url.startsWith("http")) url = "https://" + url;
let title = url;
Expand Down

0 comments on commit e51731e

Please sign in to comment.