Skip to content

Commit

Permalink
fixed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
renebrandel committed Apr 29, 2024
1 parent d724ee4 commit 7323e98
Show file tree
Hide file tree
Showing 7 changed files with 756 additions and 156 deletions.
878 changes: 736 additions & 142 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"@aws-amplify/ui-react": "^6.1.8",
"@aws-sdk/client-bedrock-runtime": "^3.564.0",
"@aws-sdk/client-s3": "^3.564.0",
"aws-amplify": "^6.1.5-unstable.89ecc6d.0",
"aws-amplify": "^6.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"throttle-debounce": "^5.0.0"
},
"devDependencies": {
"@aws-amplify/backend": "^0.13.3",
"@aws-amplify/backend-cli": "^0.14.0",
"@aws-amplify/backend": "^0.15.0",
"@aws-amplify/backend-cli": "^0.15.0",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/throttle-debounce": "^5.0.2",
Expand Down
9 changes: 5 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ function generateRandomEmoji() {

const client = generateClient<Schema>()

const defaultRoom: Schema["Room"] = {
const defaultRoom = {
id: "default",
topic: "default",
createdAt: "",
updatedAt: ""
}
updatedAt: "",
pictures: async () => ({ data: [] })
} satisfies Schema["Room"]["type"]

function App() {
const [username, setUsername] = useState<string>(generateRandomEmoji())
const [currentRoomId, setCurrentRoomId] = useState<string>("default")
const [rooms, setRooms] = useState<Schema["Room"][]>([defaultRoom])
const [rooms, setRooms] = useState<Schema["Room"]["type"][]>([defaultRoom])

useEffect(() => {
const sub = client.models.Room.observeQuery().subscribe({
Expand Down
2 changes: 1 addition & 1 deletion src/ControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RoomSelector } from "./RoomSelector";

export function ControlPanel(props: {
currentRoomId: string,
rooms: Schema["Room"][],
rooms: Schema["Room"]["type"][],
onRoomChange: (roomId: string) => void,
username: string,
onUsernameChange: React.MouseEventHandler<HTMLButtonElement>,
Expand Down
6 changes: 4 additions & 2 deletions src/PictureManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type PictureManagerProps = {
const client = generateClient<Schema>()

export function PictureManager({ roomId }: PictureManagerProps) {
const [pictures, setPictures] = useState<Schema["Picture"][]>([])
const [pictures, setPictures] = useState<Schema["Picture"]["type"][]>([])
const [imageUrls, setImageUrls] = useState<string[]>([])
const [haiku, setHaiku] = useState<string>()

Expand Down Expand Up @@ -71,7 +71,9 @@ export function PictureManager({ roomId }: PictureManagerProps) {

<button onClick={async () => {
const { data } = await client.queries.generateHaiku({ roomId })
setHaiku(data)
if (data !== null) {
setHaiku(data)
}
}}>Generate Haiku</button>
</div>
</>
Expand Down
7 changes: 5 additions & 2 deletions src/RoomSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function RoomSelector({
currentRoomId,
onRoomChange
}: {
rooms: Schema["Room"][],
rooms: Schema["Room"]["type"][],
currentRoomId: string,
onRoomChange: (roomId: string) => void
}) {
Expand All @@ -26,7 +26,10 @@ export function RoomSelector({
const { data: room } = await client.models.Room.create({
topic: newRoomName
})
onRoomChange(room.id)

if (room !== null) {
onRoomChange(room.id)
}
}}>[+ add]</button>
</>
}
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import './index.css'
import { Amplify } from 'aws-amplify';
import { Authenticator } from '@aws-amplify/ui-react';
import '@aws-amplify/ui-react/styles.css'
import config from '../amplifyconfiguration.json'
import outputs from '../amplify_outputs.json'

Amplify.configure(config);
Amplify.configure(outputs);

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
Expand Down

0 comments on commit 7323e98

Please sign in to comment.