Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const i18n = createI18n({
"link.loading": "Loading the link…",
"link.mark_as_read": "Mark as read",
"link.mark_as_read_later": "Read later",
"link.refresh": "Refresh",
"link.tab_unsync": "This link does not correspond to the current tab.",
"loading.in_progress": "Loading in progress…",
"login.email.label": "Email address",
"login.errors.server_error":
Expand Down Expand Up @@ -120,6 +122,8 @@ export const i18n = createI18n({
"link.loading": "Chargement du lien…",
"link.mark_as_read": "Marquer comme lu",
"link.mark_as_read_later": "Lire plus tard",
"link.refresh": "Actualiser",
"link.tab_unsync": "Ce lien ne correspond pas à l’onglet courant.",
"loading.in_progress": "Chargement en cours…",
"login.email.label": "Adresse courriel",
"login.errors.server_error":
Expand Down
25 changes: 25 additions & 0 deletions src/screens/LinkScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
</div>
</div>

<div v-if="link.url != currentTabUrl" class="panel panel--rounded panel--grey cols cols--always cols--gap-small cols--center">
<p class="col--extend">
{{ t("link.tab_unsync") }}
</p>

<div>
<button type="button" @click="refreshForCurrentTab">
<Icon name="sync" />
{{ t("link.refresh") }}
</button>
</div>
</div>

<div class="cols cols--always cols--center cols--gap-small">
<div class="col--extend cols cols--always cols--center cols--gap-small">
<button v-if="!link.isRead || link.isReadLater" class="button--icon" @click.prevent="markAsRead">
Expand Down Expand Up @@ -110,6 +123,7 @@ const { t, locale } = useI18n();
locale.value = store.locale;

const link = reactive(new Link());
const currentTabUrl = ref("");
const ready = ref(false);
const displayCollections = ref(false);
const alert = ref({
Expand All @@ -133,6 +147,8 @@ async function getCurrentTab() {
}

async function refreshForCurrentTab() {
ready.value = false;

const url = (await getCurrentTab()).url;

if (!url.startsWith("http://") && !url.startsWith("https://")) {
Expand Down Expand Up @@ -170,6 +186,10 @@ async function refreshForCurrentTab() {
});
}

async function refreshCurrentTabUrl() {
currentTabUrl.value = (await getCurrentTab()).url;
}

async function markAsRead() {
api.markLinkAsRead(link)
.then(() => {
Expand Down Expand Up @@ -197,4 +217,9 @@ async function markAsReadLater() {
}

onMounted(refreshForCurrentTab);
onMounted(refreshCurrentTabUrl);

browser.tabs.onUpdated.addListener(refreshCurrentTabUrl);
browser.tabs.onActivated.addListener(refreshCurrentTabUrl);
browser.windows.onFocusChanged.addListener(refreshCurrentTabUrl);
</script>