Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import { useFilters } from "@/composables/useFilters";
import { useModals } from "@/composables/useModals";
import { useComponentsBuilder } from "@/composables/useComponentsBuilder";
import { syncMatriculaStudent, updateStudent, type UpdatedStudent } from "@/services/next";
import { storage } from "wxt/storage";

const SYNC_TOAST_STORAGE_KEY = "local:lastSessionSyncToastAt";
const SYNC_TOAST_INTERVAL_MS = 24 * 60 * 60 * 1000;

const matriculas = inject<typeof window.matriculas>("matriculas");
const sessionId = inject<string>("sessionId");
Expand Down Expand Up @@ -57,17 +53,6 @@ const sessionMutation = useMutation({
},
onError: (error) => {
logger.error({ error }, "Failed to sync session");
toast.error("Falha ao sincronizar dados da sessão");
},
onSuccess: async () => {
const lastShownAt = await storage.getItem<number>(SYNC_TOAST_STORAGE_KEY);
const alreadyShownRecently = lastShownAt && Date.now() - lastShownAt < SYNC_TOAST_INTERVAL_MS;
if (alreadyShownRecently) {
return;
}

toast.success("Sessão sincronizada com sucesso");
await storage.setItem(SYNC_TOAST_STORAGE_KEY, Date.now());
},
});

Expand Down
19 changes: 0 additions & 19 deletions apps/extension/src/entrypoints/matricula.content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { sendMessage } from "@/messaging";
import { logger } from "@/utils/logger";
import type { ContentScriptContext } from "wxt/client";
import { getStudent } from "@/services/next";
import { Toaster } from "vue-sonner";

export type UFABCMatriculaStudent = {
studentId: number;
Expand All @@ -23,8 +22,6 @@ export default defineContentScript({
const ui = await mountUFABCMatriculaFilters(ctx, sessionId, login);
ui.mount();

mountToaster(ctx).mount();

const $meio = document.querySelector<HTMLDivElement>("#meio");
const $mountedUi = $meio?.firstChild as unknown as HTMLDivElement;

Expand Down Expand Up @@ -95,22 +92,6 @@ async function mountUFABCMatriculaFilters(ctx: ContentScriptContext, sessionId:
});
}

function mountToaster(ctx: ContentScriptContext) {
return createIntegratedUi(ctx, {
position: "inline",
anchor: "body",
append: "last",
onMount(wrapper) {
const app = createApp(Toaster, { position: "top-right" });
app.mount(wrapper);
return app;
},
onRemove(app) {
app?.unmount();
},
});
}

async function getToken() {
try {
const token = await sendMessage("getTokenMatricula", {
Expand Down
Loading