mirror of
https://github.com/QwIT-Development/firka-extension.git
synced 2026-06-12 03:41:39 +02:00
Page settings
This commit is contained in:
@@ -37,6 +37,8 @@ h2 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
|
||||
gap: 20px;
|
||||
justify-content: center;
|
||||
justify-items: center;
|
||||
}
|
||||
|
||||
.widget-card {
|
||||
@@ -50,6 +52,7 @@ h2 {
|
||||
height: 100%;
|
||||
border: none;
|
||||
min-height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.widget-header {
|
||||
@@ -222,7 +225,6 @@ h2 {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
/* Mobile view: author below content */
|
||||
@media (max-width: 768px) {
|
||||
.news-item .widget-row {
|
||||
flex-direction: column;
|
||||
@@ -257,7 +259,6 @@ h2 {
|
||||
}
|
||||
}
|
||||
|
||||
/* Desktop view: limit author width and wrap text */
|
||||
@media (min-width: 769px) {
|
||||
.news-author {
|
||||
max-width: 180px;
|
||||
|
||||
@@ -291,8 +291,9 @@ class DashboardDataManager {
|
||||
}
|
||||
|
||||
class DashboardRenderer {
|
||||
constructor(data) {
|
||||
constructor(data, settings = {}) {
|
||||
this.baseData = data;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
async init() {
|
||||
@@ -315,14 +316,31 @@ class DashboardRenderer {
|
||||
}
|
||||
|
||||
generateMainContent() {
|
||||
const cards = [];
|
||||
|
||||
if (!this.settings.hideGrades) {
|
||||
cards.push(this.createGradeCard());
|
||||
}
|
||||
if (!this.settings.hideAbsences) {
|
||||
cards.push(this.createAbsenceCard());
|
||||
}
|
||||
if (!this.settings.hideNotes) {
|
||||
cards.push(this.createNoteCard());
|
||||
}
|
||||
if (!this.settings.hideExams) {
|
||||
cards.push(this.createExamCard());
|
||||
}
|
||||
|
||||
cards.push(this.createNewsCard());
|
||||
|
||||
if (cards.length === 1) {
|
||||
cards.unshift(this.createGradeCard());
|
||||
}
|
||||
|
||||
return `
|
||||
<main class="kreta-main">
|
||||
<div class="grid-container">
|
||||
${this.createGradeCard()}
|
||||
${this.createAbsenceCard()}
|
||||
${this.createNoteCard()}
|
||||
${this.createExamCard()}
|
||||
${this.createNewsCard()}
|
||||
${cards.join('')}
|
||||
</div>
|
||||
</main>
|
||||
`;
|
||||
@@ -513,6 +531,26 @@ class DashboardApplication {
|
||||
this.init();
|
||||
}
|
||||
|
||||
async loadBulletinSettings() {
|
||||
try {
|
||||
const settings = await storageManager.get("pageSettings_bulletin", {});
|
||||
return {
|
||||
hideGrades: settings.hideGrades || false,
|
||||
hideAbsences: settings.hideAbsences || false,
|
||||
hideNotes: settings.hideNotes || false,
|
||||
hideExams: settings.hideExams || false
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error loading bulletin settings:", error);
|
||||
return {
|
||||
hideGrades: false,
|
||||
hideAbsences: false,
|
||||
hideNotes: false,
|
||||
hideExams: false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async init() {
|
||||
if (!window.location.href.includes("/Intezmeny/Faliujsag")) {
|
||||
return;
|
||||
@@ -575,8 +613,9 @@ class DashboardApplication {
|
||||
try {
|
||||
const dataManager = new DashboardDataManager();
|
||||
const dashboardData = await dataManager.extractAllData();
|
||||
const bulletinSettings = await this.loadBulletinSettings();
|
||||
|
||||
const renderer = new DashboardRenderer(dashboardData);
|
||||
const renderer = new DashboardRenderer(dashboardData, bulletinSettings);
|
||||
await renderer.render();
|
||||
} catch (error) {
|
||||
console.error("Error initializing dashboard:", error);
|
||||
|
||||
Reference in New Issue
Block a user