Skip to content

Commit 77d7855

Browse files
authored
Merge pull request #49 from aws-samples/feature/class_creation
add class feature creation
2 parents 939707d + d6ce469 commit 77d7855

File tree

9 files changed

+47873
-7422
lines changed

9 files changed

+47873
-7422
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ node_modules
3232
amplify_outputs.json
3333
amplify/.DS_Store
3434
dist
35-
.DS_Store
35+
.DS_Store
36+
amplify/
37+
38+
# amplify
39+
amplify_outputs*
40+
amplifyconfiguration*

package-lock.json

Lines changed: 47179 additions & 7390 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@
1515
"@cloudscape-design/components": "^3.0.611",
1616
"@cloudscape-design/design-tokens": "^3.0.35",
1717
"@cloudscape-design/global-styles": "^1.0.27",
18-
"aws-amplify": "^6.5.1",
18+
"aws-amplify": "^6.15.7",
1919
"moment": "^2.30.1",
2020
"react": "^18.2.0",
2121
"react-dom": "^18.2.0",
2222
"react-player": "^2.16.0",
2323
"react-router-dom": "^6.22.0"
2424
},
2525
"devDependencies": {
26-
"@aws-amplify/backend": "^1.1.1",
27-
"@aws-amplify/backend-cli": "^1.2.4",
26+
"@aws-amplify/backend": "^1.16.1",
27+
"@aws-amplify/backend-cli": "^1.8.0",
2828
"@types/react": "^18.2.66",
2929
"@types/react-dom": "^18.2.22",
3030
"@typescript-eslint/eslint-plugin": "^7.2.0",
3131
"@typescript-eslint/parser": "^7.2.0",
3232
"@vitejs/plugin-react": "^4.2.1",
3333
"autoprefixer": "^10.4.17",
3434
"aws-cdk": "^2.153.0",
35-
"aws-cdk-lib": "^2.153.0",
36-
"constructs": "^10.3.0",
35+
"aws-cdk-lib": "^2.204.0",
36+
"constructs": "^10.4.2",
3737
"esbuild": "^0.20.2",
3838
"eslint": "^8.57.0",
3939
"eslint-plugin-react-hooks": "^4.6.0",
4040
"eslint-plugin-react-refresh": "^0.4.6",
4141
"postcss": "^8.4.35",
4242
"sass": "^1.70.0",
43-
"tsx": "^4.17.0",
44-
"typescript": "^5.5.4",
43+
"tsx": "^4.20.6",
44+
"typescript": "^5.9.3",
4545
"vite": "^5.4.11"
4646
}
4747
}

src/components/Class.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Class = ({
1919
return (
2020
<>
2121
<SpaceBetween size="l">
22-
<Player classId={activeClass.id} title={activeClass.name} desc={activeClass.description} author={activeClass.author} url={activeClass.url} user={userName} uid={userId} />
22+
<Player classId={activeClass.id} title={activeClass.name} desc={activeClass.description} author={activeClass.author} url={activeClass.url} user={userName} uid={userId} subtitle={activeClass.subtitle} />
2323

2424
<Bot transcript={activeClass.transcript}></Bot>
2525

src/components/ClassCatalog.tsx

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
import { useEffect, useState } from "react";
22
import {
3-
Cards, Link, StatusIndicator, Box, Pagination, Header
3+
Cards, Link, StatusIndicator, Box, Pagination, Header, Button, Modal
44
} from "@cloudscape-design/components";
55

66
// api
77
import { generateClient } from 'aws-amplify/data';
88
import { Schema } from '../../amplify/data/resource';
9+
import { CreateClassWizard } from './CreateClassWizard';
910

1011
const client = generateClient<Schema>();
1112

1213
const ClassCatalog = ({
1314
activeCourse,
1415
setActiveClass,
16+
userProfile,
1517
}: {
1618
activeCourse: any,
17-
setActiveClass: any
19+
setActiveClass: any,
20+
userProfile: any
1821
}) => {
1922
const [classes, setClasses] = useState<Array<Schema["Class"]["type"]>>([]);
2023
const [loading, setLoading] = useState(true);
2124
const [currentPage, setCurrentPage] = useState(1);
22-
const itemsPerPage = 4;
25+
const itemsPerPage = 4;
26+
27+
// Wizard state
28+
const [showWizard, setShowWizard] = useState(false);
2329

2430
useEffect(() => {
2531
const fetchClasses = async () => {
@@ -43,8 +49,13 @@ const ClassCatalog = ({
4349

4450
const pagesCount = Math.ceil(classes.length / itemsPerPage);
4551

52+
const handleClassCreated = (newClass: Schema["Class"]["type"]) => {
53+
setClasses([...classes, newClass]);
54+
};
55+
4656
return (
47-
<Cards
57+
<>
58+
<Cards
4859
ariaLabels={{
4960
itemSelectionLabel: (_, n) => `select ${n.name}`,
5061
selectionGroupLabel: "Item selection"
@@ -103,7 +114,19 @@ const ClassCatalog = ({
103114
</Box>
104115
}
105116
header={activeCourse && activeCourse != null ? (
106-
<Header>{activeCourse.name}</Header>
117+
<Header
118+
actions={
119+
<Button
120+
variant="primary"
121+
iconName="add-plus"
122+
onClick={() => setShowWizard(true)}
123+
>
124+
Add Class
125+
</Button>
126+
}
127+
>
128+
{activeCourse.name}
129+
</Header>
107130
) : (
108131
<div />
109132
)}
@@ -117,6 +140,22 @@ const ClassCatalog = ({
117140
/>
118141
}
119142
/>
143+
144+
<Modal
145+
visible={showWizard}
146+
onDismiss={() => setShowWizard(false)}
147+
size="max"
148+
header="Create New Class"
149+
>
150+
<CreateClassWizard
151+
visible={showWizard}
152+
onDismiss={() => setShowWizard(false)}
153+
activeCourse={activeCourse}
154+
onComplete={handleClassCreated}
155+
userProfile={userProfile}
156+
/>
157+
</Modal>
158+
</>
120159
);
121160
}
122161

src/components/CommentForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ export const CommentForm = ({
8989
Format your response as follows:
9090
9191
📚 Summary:
92-
[Provide a concise summary of the overall sentiment and main points]
92+
[Provide a concise summary of the positive and negative sentiment]
9393
94-
⭐️ Overall Score : [_/5]
94+
⭐️ Number of positive comment :
95+
⭐️ Number of Negative comment :
9596
9697
💫 Key Reason:
9798
[Main reason for the score]`;

0 commit comments

Comments
 (0)