diff --git a/src/assets/after-sunset-minimal-4k-zm-3840x2400.jpg b/src/assets/after-sunset-minimal-4k-zm-3840x2400.jpg new file mode 100644 index 0000000..1888bc5 Binary files /dev/null and b/src/assets/after-sunset-minimal-4k-zm-3840x2400.jpg differ diff --git a/src/assets/images.jpg b/src/assets/images.jpg new file mode 100644 index 0000000..b3a1f7f Binary files /dev/null and b/src/assets/images.jpg differ diff --git a/src/pages/DashboardPage.ts b/src/pages/DashboardPage.ts index 2e99b44..9b6c4eb 100644 --- a/src/pages/DashboardPage.ts +++ b/src/pages/DashboardPage.ts @@ -7,7 +7,7 @@ import { createElement } from '../utils/utils'; class WelcomeWidget extends Widget { render(): HTMLElement { const widgetDiv = createElement('div'); - widgetDiv.classList.add('widget'); + widgetDiv.classList.add('widget', 'welcome-widget'); widgetDiv.innerHTML = `
Welcome to the Dashboard
@@ -21,7 +21,7 @@ class WelcomeWidget extends Widget { class QuickLinksWidget extends Widget { render(): HTMLElement { const widgetDiv = createElement('div'); - widgetDiv.classList.add('widget'); + widgetDiv.classList.add('widget', 'quick-links-widget'); widgetDiv.innerHTML = `
Quick Links
@@ -36,21 +36,20 @@ class QuickLinksWidget extends Widget { } } -class PlaceholderWidget extends Widget { // Corrected placeholder widget definition +class PlaceholderWidget extends Widget { render(): HTMLElement { const div = createElement('div'); - div.classList.add('widget'); + div.classList.add('widget', 'placeholder-widget'); div.textContent = 'Placeholder Widget'; return div; } } - export const renderDashboardPage = () => { const layout = new ThreeColumnLayout(); const welcomeWidget = new WelcomeWidget(); const quickLinksWidget = new QuickLinksWidget(); - const placeholderWidget = new PlaceholderWidget(); // Use the corrected PlaceholderWidget class + const placeholderWidget = new PlaceholderWidget(); layout.setColumn1Content(welcomeWidget.render()); layout.setColumn2Content(quickLinksWidget.render()); diff --git a/src/style.css b/src/style.css index 3bd4490..2b8606e 100644 --- a/src/style.css +++ b/src/style.css @@ -14,19 +14,57 @@ body { overflow: hidden; font-family: sans-serif; } +.login-container { + background-image: url('./assets/images.jpg'); /* Replace with your logo path */ + background-repeat: no-repeat; + background-position: center top; /* Center the logo at the top */ + background-size: 80x 80px; /* Adjust the size of the logo */ + padding-top: 60px; /* Add padding to create space for the logo */ + text-align: center; /* Center text and form elements */ +} +.logo { + width: 80px; /* Set the width of the logo */ + height: 80px; /* Set the height of the logo */ + border-radius: 50%; /* Make the logo circular */ + background-image: url('./assets/images.jpg'); /* Replace with your logo path */ + background-size: cover; /* Cover the entire area */ + margin: 0 auto 20px; /* Center the logo and add space below */ +} + +.widget-header { + + text-align: center; /* Center the text */ + margin-top: 20px; /* Space between logo and header */ + font-size: 24px; /* Adjust font size as needed */ + font-weight: bold; /* Make the text bold if desired */ + +} + +.mb-3 { + margin-bottom: 15px; /* Space between form groups */ +} + +.btn { + margin-top: 10px; /* Space above the button */ +} .scrolling-background { position: fixed; top: 0; left: 0; - width: 100%; /* Ensure it covers full width */ - height: 100vh; /* Full viewport height */ - background-image: url('./assets/bg1.jpg'); + width: 100%; + height: 100vh; + background-image: url('./assets/after-sunset-minimal-4k-zm-3840x2400.jpg'); background-repeat: repeat-x; - background-size: auto 100%; /* Maintain width and fill height */ + background-size: auto 100%; animation: scroll-bg 30s linear infinite; z-index: -2; } +.logo { + display: block; + margin: 0 auto 20px; /* Center the logo and add space below */ + max-width: 100px; /* Adjust the size as needed */ +} @keyframes scroll-bg { from { @@ -60,9 +98,6 @@ body { font-weight: bold; } -.widget-body { - /* Widget body styles */ -} .icon-widget { padding: 10px; diff --git a/src/widgets/LoginWidget.ts b/src/widgets/LoginWidget.ts index 1961c05..54c792c 100644 --- a/src/widgets/LoginWidget.ts +++ b/src/widgets/LoginWidget.ts @@ -11,52 +11,40 @@ export class LoginWidget extends Widget { render(): HTMLElement { this.container.innerHTML = ''; + // Create a logo container + const logoContainer = createElement('div') as HTMLElement; + logoContainer.classList.add('logo'); // Add class for circular logo + this.container.appendChild(logoContainer); + + // Create header const header = createElement('h2'); header.classList.add('widget-header'); header.textContent = 'Login'; + this.container.appendChild(header); + // Create form const form = createElement('form'); - const userIdInputGroup = createElement('div'); - userIdInputGroup.classList.add('mb-3'); - const userIdLabel = createElement('label') as HTMLLabelElement; // Cast first - userIdLabel.classList.add('form-label'); - userIdLabel.htmlFor = 'userId'; // Set htmlFor as property - userIdLabel.textContent = 'Student ID'; - const userIdInput = createElement('input') as HTMLInputElement; - userIdInput.type = 'text'; - userIdInput.classList.add('form-control'); - userIdInput.id = 'userId'; - userIdInput.placeholder = '123456'; - userIdInputGroup.appendChild(userIdLabel); - userIdInputGroup.appendChild(userIdInput); - const passwordInputGroup = createElement('div'); - passwordInputGroup.classList.add('mb-3'); - const passwordLabel = createElement('label') as HTMLLabelElement; // Cast first - passwordLabel.classList.add('form-label'); - passwordLabel.htmlFor = 'password'; // Set htmlFor as property - passwordLabel.textContent = 'Password'; - const passwordInput = createElement('input') as HTMLInputElement; - passwordInput.type = 'password'; - passwordInput.classList.add('form-control'); - passwordInput.id = 'password'; - passwordInput.placeholder = 'Password'; - passwordInputGroup.appendChild(passwordLabel); - passwordInputGroup.appendChild(passwordInput); + // User ID input group + const userIdInputGroup = this.createInputGroup('userId', 'Student ID', 'text', 'Student ID'); + form.appendChild(userIdInputGroup); + // Password input group + const passwordInputGroup = this.createInputGroup('password', 'Password', 'password', 'Password'); + form.appendChild(passwordInputGroup); + + // Login button const loginButton = createElement('button'); loginButton.type = 'submit'; loginButton.classList.add('btn', 'btn-primary'); loginButton.textContent = 'Login'; - - form.appendChild(userIdInputGroup); - form.appendChild(passwordInputGroup); form.appendChild(loginButton); + // Form submission handler form.addEventListener('submit', async (event) => { event.preventDefault(); - const userId = userIdInput.value; - const password = passwordInput.value; + const userId = (userIdInputGroup.querySelector('input') as HTMLInputElement).value; + const password = (passwordInputGroup.querySelector('input') as HTMLInputElement).value; try { const response: ApiResponse = await globalAPI.login({ userId, password }); @@ -71,8 +59,28 @@ export class LoginWidget extends Widget { } }); - this.container.appendChild(header); this.container.appendChild(form); return this.container; } + + private createInputGroup(id: string, labelText: string, inputType: string, placeholder: string): HTMLElement { + const inputGroup = createElement('div'); + inputGroup.classList.add('mb-3'); + + const label = createElement('label') as HTMLLabelElement; + label.classList.add('form-label'); + label.htmlFor = id; + label.textContent = labelText; + + const input = createElement('input') as HTMLInputElement; + input.type = inputType; + input.classList.add('form-control'); + input.id = id; + input.placeholder = placeholder; + + inputGroup.appendChild(label); + inputGroup.appendChild(input); + + return inputGroup; + } } \ No newline at end of file diff --git a/src/widgets/RegisterWidget.ts b/src/widgets/RegisterWidget.ts index cfb401e..05715f0 100644 --- a/src/widgets/RegisterWidget.ts +++ b/src/widgets/RegisterWidget.ts @@ -7,11 +7,11 @@ export class RegisterWidget extends Widget { constructor(message?: string) { super(); - this.message = message || "For registration, please contact your department head for further instructions."; + this.message = message || "Please register first.. "; } render(): HTMLElement { - this.container.innerHTML = ''; // Clear previous content + this.container.innerHTML = ''; const header = createElement('h2'); header.classList.add('widget-header'); @@ -24,7 +24,7 @@ export class RegisterWidget extends Widget { const button = createElement('button'); button.classList.add('btn', 'btn-secondary'); button.textContent = 'Register'; - button.disabled = true; + button.addEventListener('click', () => { navigateTo('/register'); }); @@ -34,4 +34,4 @@ export class RegisterWidget extends Widget { this.container.appendChild(button); return this.container; } -} \ No newline at end of file +}