From a2cbecd9deb6e52b8b174e224da7b1f34f432950 Mon Sep 17 00:00:00 2001 From: ashwaqaljanahi2021 Date: Sun, 10 Nov 2024 10:01:52 -0500 Subject: [PATCH] fixed mobile viewing for assignment pages for student and instructors --- .../migration/1730867565396-publicCourses.ts | 27 +++++++-- .../assignments/assignmentDetailPage.scss | 57 +++++++++++++++++-- 2 files changed, 73 insertions(+), 11 deletions(-) diff --git a/devU-api/src/migration/1730867565396-publicCourses.ts b/devU-api/src/migration/1730867565396-publicCourses.ts index 029ff8c..79a7b46 100644 --- a/devU-api/src/migration/1730867565396-publicCourses.ts +++ b/devU-api/src/migration/1730867565396-publicCourses.ts @@ -4,13 +4,30 @@ export class Migration1730867565396 implements MigrationInterface { name = 'Migration1730867565396' public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "courses" ADD "is_public" boolean NOT NULL DEFAULT false`); - await queryRunner.query(`ALTER TABLE "courses" ADD "private_data" TIMESTAMP NOT NULL DEFAULT now()`); + //have to use raw SQL to fix queryfailederror for columns that already exist + const isPublicExists = await queryRunner.query(` + SELECT column_name + FROM information_schema.columns + WHERE table_name = 'courses' AND column_name = 'is_public'; + `); + + if (isPublicExists.length === 0) { + await queryRunner.query(`ALTER TABLE "courses" ADD "is_public" boolean NOT NULL DEFAULT false`); + } + + const privateDataExists = await queryRunner.query(` + SELECT column_name + FROM information_schema.columns + WHERE table_name = 'courses' AND column_name = 'private_data'; + `); + + if (privateDataExists.length === 0) { + await queryRunner.query(`ALTER TABLE "courses" ADD "private_data" TIMESTAMP NOT NULL DEFAULT now()`); + } } public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN "private_data"`); - await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN "is_public"`); + await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN IF EXISTS "private_data"`); + await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN IF EXISTS "is_public"`); } - } diff --git a/devU-client/src/components/pages/assignments/assignmentDetailPage.scss b/devU-client/src/components/pages/assignments/assignmentDetailPage.scss index 182c493..aa3e8e4 100644 --- a/devU-client/src/components/pages/assignments/assignmentDetailPage.scss +++ b/devU-client/src/components/pages/assignments/assignmentDetailPage.scss @@ -174,16 +174,61 @@ padding: 10px; } +@media (max-width: 768px) { + .wrap { + flex-direction: column; + align-items: center; + padding: 15px; + } + + .assignment_card { + width: 90%; + max-width: 500px; + margin: 0 auto; + padding: 20px; + } + + .options_buttons { + flex-direction: column; + justify-content: center; + width: 100%; + gap: 10px; + } + + .buttons { + width: auto; + padding: 10px 20px; + font-size: 15px; + margin: 0; + } + .card { + background-color: $list-item-background; + border-radius: 8px; + padding: 20px; + width: 200px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + margin: 20px; + } +} + @media (max-width: 370px) { .header { - flex-direction: column; - align-items: center; - width:400px; - + align-items: center; + padding: 10px; + } + + .card, .assignment_card { + width: 100%; + max-width: 100%; + padding: 15px; } .buttons { - width: 100%; - max-width: none; + padding: 10px; + font-size: 14px; + } + + .submissionsContainer { + padding: 10px; } } \ No newline at end of file