2 lines
9.6 KiB
JSON
2 lines
9.6 KiB
JSON
|
|
{"id":"chatcmpl-8a984ef377240172","object":"chat.completion","created":1774200381,"model":"NousResearch\/Hermes-3-Llama-3.2-3B","choices":[{"index":0,"message":{"role":"assistant","content":"Here is the complete ProfilePage.tsx component:\n\n```typescript\n\/\/ src\/components\/ProfilePage.tsx\nimport React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { Link, useHistory, useLocation } from 'react-router-dom';\nimport { Avatar, Typography, Button, IconButton, Tooltip, Chip, TextField, InputAdornment, FormControlLabel, Checkbox, Switch } from '@material-ui\/core';\nimport { makeStyles } from '@material-ui\/core\/styles';\nimport { useAuth } from '..\/context';\nimport { useNotifications } from '..\/context\/NotificationsContext';\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n flexDirection: 'column',\n },\n avatar: {\n width: theme.spacing(8),\n height: theme.spacing(8),\n borderRadius: '50%',\n },\n}));\n\nconst ProfilePage: React.FC = () => {\n const { user } = useAuth();\n const notifications = useNotifications();\n const history = useHistory();\n const location = useLocation();\n const profileRef = useRef(null);\n\n const handleUpdateProfile = async (values: any) => {\n \/\/ Handle profile update logic here\n };\n\n useEffect(() => {\n if (profileRef.current) {\n profileRef.current.clear();\n }\n }, [user]);\n\n return (\n <div className={classes.root}>\n <Container maxWidth=\"xl\">\n <div className={classes.avatar} ref={profileRef}>\n <Avatar src={user.avatar} alt=\"Profile\" \/>\n <\/div>\n <Typography variant=\"h6\">{user.username}<\/Typography>\n <Typography>Timezone: {user.timezone}<\/Typography>\n <Typography>Joined: {user.created_at.substring(0, 10)}<\/Typography>\n <Typography>Bio: {user.bio}<\/Typography>\n <TextField\n label=\"New Name\"\n variant=\"outlined\"\n fullWidth\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => history.push('\/settings\/profile\/name')}>\n <Typography>Edit<\/Typography>\n <\/IconButton>\n <\/InputAdornment>\n ),\n }}\n \/>\n <TextField\n label=\"New Email\"\n variant=\"outlined\"\n fullWidth\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => history.push('\/settings\/profile\/email')}>\n <Typography>Edit<\/Typography>\n <\/IconButton>\n <\/InputAdornment>\n ),\n }}\n \/>\n <TextField\n label=\"New Timezone\"\n variant=\"outlined\"\n fullWidth\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => history.push('\/settings\/profile\/timezone')}>\n <Typography>Edit<\/Typography>\n <\/IconButton>\n <\/InputAdornment>\n ),\n }}\n \/>\n <TextField\n label=\"New Bio\"\n variant=\"outlined\"\n fullWidth\n multiline\n rows={4}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => history.push('\/settings\/profile\/bio')}>\n <Typography>Edit<\/Typography>\n <\/IconButton>\n <\/InputAdornment>\n ),\n }}\n \/>\n <TextField\n label=\"New Password\"\n type=\"password\"\n variant=\"outlined\"\n fullWidth\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => history.push('\/settings\/profile\/password')}>\n
|