8000 feat/activities by Deepsn · Pull Request #10 · bb-work-org/bb-work · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat/activities #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ea6f5e2
feat: show courses from userid
Deepsn Sep 12, 2023
3aa1212
fix(auth-fetch-base): only return data/error on request
Deepsn Sep 12, 2023
64b4546
feat: show courses on landing page
Deepsn Sep 12, 2023
e87bfcf
Merge remote-tracking branch 'origin/main' into feat/activities
Deepsn Sep 13, 2023
7e38044
chore: use grid layout for activities list
Deepsn Sep 13, 2023
1202c21
feat: handle clicks on course cards
Deepsn Sep 13, 2023
2c397a3
fix: add null checks on some user data usage
Deepsn Sep 13, 2023
77e6fdb
chore: rename courses-api to course-api for consistency
Deepsn Sep 13, 2023
abdf454
feat: show activities for course
Deepsn Sep 13, 2023
6f814ce
feat: change opacity of expired courses
Deepsn Sep 13, 2023
c3b9f9e
feat: show only activities, use list instead of grid
Deepsn Sep 14, 2023
2c6776d
feat: add completed icon on activities
Deepsn Sep 14, 2023
e1bca86
fix: wrong import on dashboard page
Deepsn Sep 14, 2023
610be68
feat: show expire date
Deepsn Sep 14, 2023
757dace
Merge remote-tracking branch 'origin/main' into feat/activities
Deepsn Sep 17, 2023
cc76857
Merge remote-tracking branch 'origin/main' into feat/activities
Deepsn Sep 17, 2023
0e552fc
Merge remote-tracking branch 'origin/main' into feat/activities
Deepsn Sep 17, 2023
ccda366
feat: show banner image on courses
Deepsn Sep 17, 2023
3cfec25
refactor: remove old dashboard route
Deepsn Sep 17, 2023
997bd1b
chore: center loading icon on activities page
Deepsn Sep 17, 2023
4a13c9e
fix: redirect to course with locale
Deepsn Sep 17, 2023
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
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
images: { unoptimized: true }
};

module.exports = nextConfig;
211 changes: 211 additions & 0 deletions src/@types/activities.ts
8000
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
export interface ActivityResult {
permissions: unknown;
paging: {
count: number;
limit: number;
nextPage: string;
offset: number;
previousPage: string;
};
results: Activity[];
}

export interface Activity {
iconUrl: string
launchInNewWindow: boolean
contentDetail: ContentDetail
modifiedDate: number
courseId: string
title: string
isReviewable: boolean
isGroupContent: boolean
inSequence: boolean
dueDateExceptionType: string
renderType: string
thumbnailAltText: string
aiState: string
inLesson: boolean
titleColor: string
position: number
contentHandler: ContentHandler
description: string
body: Body
permissions: Permissions
id: string
state: string
visibility?: string
parentId?: string
adaptiveReleaseRules?: AdaptiveReleaseRules
}

type ContentHandler = "resource/x-bb-folder"
| "resource/x-bb-file"
| "resource/x-bb-assignment"
| "resource/x-bb-externallink";

export interface ContentDetail {
"resource/x-bb-folder"?: ResourceXBbFolder
"resource/x-bb-file"?: ResourceXBbFile
"resource/x-bb-assignment"?: ResourceXBbAssignment
"resource/x-bb-externallink"?: ResourceXBbExternallink
}

export interface ResourceXBbFolder {
isBbPage: boolean
isFolder: boolean
}

export interface ResourceXBbFile {
file: File
fileAssociationMode: string
}

export interface File {
existingFileReference: string
permanentUrl: string
mimeType: string
viewerUrl: string
forceDownload: boolean
isMedia: boolean
fileName: string
xid: string
}

export interface ResourceXBbAssignment {
gradingColumn: GradingColumn
groupContent: boolean
safeAssignOptions: SafeAssignOptions
}

export interface GradingColumn {
gradebookCategory: GradebookCategory
localizedColumnName: LocalizedColumnName
effectiveColumnName: string
isAttemptBased: boolean
gradeScoreDesignation: string
formativeIndicator: string
isFormative: boolean
courseId: string
scoreProviderHandle: string
visible: boolean
peerGrading: boolean
delegatedGrading: boolean
contentId: string
anonymousGrading: boolean
dateCreated: string
deleted: boolean
gradingSchemaId: string
columnName: string
aggregationModel: string
hideAttempt: boolean
scorable: boolean
visibleInAllTerms: boolean
visibleInBook: boolean
showStatsToStudent: boolean
limitedAttendance: boolean
userCreatedColumn: boolean
autoPostGrades: boolean
ltiDomainId: any
gradesReleased: boolean
enforceDueDate: boolean
position: number
possible: number
multipleAttempts: number
calculationType: string
gradebookCategoryId: string
id: string
"@id": string
}

export interface GradebookCategory {
isUserDefined: boolean
courseId: string
title: string
localizableTitle: LocalizableTitle
description: any
id: string
}

export interface LocalizableTitle {
languageKey: string
bundle: string
}

export interface LocalizedColumnName {
languageKey: string
bundle: string
}

export interface SafeAssignOptions {
checkAttempts: boolean
canStudentViewReports: boolean
excludeSubmissions: boolean
globalSearch: boolean
}

export interface ResourceXBbExternallink {
url: string
}

export interface Body {
rawText: string
displayText: string
webLocation: string
fileLocation: string
}

export interface Permissions {
edit: boolean
contentHandlerPermissionMap: ContentHandlerPermissionMap
modifyAvailability: boolean
adaptiveRelease: AdaptiveRelease
canHaveReviewState: boolean
canViewReviewState: boolean
canUpdateReviewState: boolean
dashboardView: boolean
createLearningStandardsAlignment: boolean
viewDesigner: boolean
delete: boolean
copy: boolean
}

export interface ContentHandlerPermissionMap {
createDiscussion: boolean
}

export interface AdaptiveRelease {
edit: boolean
criteria: Criteria
delete: boolean
create: boolean
view: boolean
}

export interface Criteria {
performance: Performance
acl: Acl
dates: Dates
}

export interface Performance {
edit: boolean
delete: boolean
create: boolean
}

export interface Acl {
edit: boolean
delete: boolean
create: boolean
}

export interface Dates {
edit: boolean
delete: boolean
create: boolean
}

export interface AdaptiveReleaseRules {
endDate: string
startDate: any
}
144 changes: 144 additions & 0 deletions src/@types/courses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
export interface CourseResponse {
permissions: unknown;
paging: {
count: number
limit: number
nextPage: string
offset: number
previousPage: string;
};
results: CourseResult[];
}
export interface CourseResult {
role: string
course: Course
courseId: string
isAvailable: boolean
modifiedDate: string
userId: string
lastAccessDate: string
receiveEmail: boolean
includedInRoster: boolean
dueDateExceptionType: string
timeLimitExceptionType: string
enrollmentDate: string
dataSourceId: string
courseRole: CourseRole
userHasHidden: boolean
courseCardColorIndex: number
id: string
}

export interface Course {
courseId: string
isAvailable: boolean
createdDate: string
modifiedDate: string
batchUid: string
uuid: string
navStyle: string
durationType: string
classificationId: string
dataSourceId: string
enrollmentType: string
paceType: string
bannerImageFile?: string
bannerAltText: string
isLocaleEnforced: boolean
defaultViewContent: string
termId?: string
isClosed: boolean
description: string
term?: Term
banner?: Banner
displayId: string
effectiveAvailability: boolean
isBannerVisible: boolean
isAllowObservers: boolean
isHonorTermAvailability: boolean
bannerImageThumbnail?: BannerImageThumbnail
isAllowGuests: boolean
displayName: string
permissions: Permissions2
ultraStatus: string
courseViewOption: string
isOrganization: boolean
externalAccessUrl: string
homePageUrl: string
name: string
id: string
guestAccessUrl?: string
}

export interface Term {
isAvailable: boolean
endDate: string
startDate: string
durationType: string
daysOfUse: number
description: Description
dataSrcId: string
permissions: Permissions
coursesPerTerm: number
name: string
id: string
}

export interface Description {
rawText: string
displayText: string
webLocation: any
fileLocation: any
}

export interface Permissions {
edit: boolean
delete: boolean
}

export interface Banner {
permanentUrl: string
forceDownload: boolean
}

export interface BannerImageThumbnail {
permanentUrl: string
forceDownload: boolean
}

export interface Permissions2 {
edit: boolean
archive: boolean
delete: boolean
export: boolean
copy: boolean
editDuration: boolean
editTerm: boolean
chooseUltraStatus: boolean
editBanner: boolean
editBannerVisibility: boolean
editAvailability: boolean
editName: boolean
editLocale: boolean
import: boolean
viewAutoArchive: boolean
messagesEnabled: boolean
convert: boolean
editClosed: boolean
viewEnrollments: boolean
}

export interface CourseRole {
courseName: CourseName
roleBucket: string
sortOrder: number
identifier: string
roleAvailability: string
isActAsInstructor: boolean
id: string
}

export interface CourseName {
bundle: string
languageKey: string
}
28 changes: 28 additions & 0 deletions src/app/[locale]/(dashboard)/courses/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use client";
import {List, Stack, Typography} from "@mui/material";
import {useGetCourseContentsQuery} from "@/redux/services/course-api";
import ActivityCard from "@/components/activity-card";

export default function CourseActivities({ params }: { params: { id: string }} ) {
const { data } = useGetCourseContentsQuery(params.id);

console.log(data, params.id)

return (
<Stack p={3} display={"flex"} direction={"column"}>
<Typography>
Activities from course - {params.id}
</Typography>

<List>
{data?.results?.map((activity) => {
if (activity.contentHandler !== "resource/x-bb-assignment") {
return;
}

return <ActivityCard key={activity.id} activity={activity} />
})}
</List>
</Stack>
)
}
Loading
0