Skip to content

Feat/add classroom #376

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

Open
wants to merge 18 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
fix stupid mistakes
  • Loading branch information
mariopesch committed Nov 25, 2024
commit 6eef34585b883919239d542d1351bda45ae20ec1
59 changes: 29 additions & 30 deletions src/components/Classroom/ProjectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,38 +58,38 @@ const ProjectList = ({ projects }) => {
justifyContent: 'space-between',
}}
>
<div style={{ position: 'relative' }}>
<BlocklyWindow
svg
blockDisabled
initialXml={project.xml}
/>
<IconButton
style={{
position: 'absolute',
top: '10px',
right: '10px',
backgroundColor: '#fff',
padding: '8px',
borderRadius: '50%',
}}
onClick={(e) => handleMenuClick(e, project)}
>
<FontAwesomeIcon icon={faGear} />
</IconButton>
</div>
<h3 style={{ marginTop: 0 }}>{project.title}</h3>
<Divider style={{ marginTop: "1rem", marginBottom: "10px" }} />
<Typography
variant="body2"
<div style={{ position: 'relative' }}>
<BlocklyWindow
svg
blockDisabled
initialXml={project.xml}
/>
<IconButton
style={{
fontStyle: "italic",
margin: 0,
marginTop: "-10px",
position: 'absolute',
top: '10px',
right: '10px',
backgroundColor: '#fff',
padding: '8px',
borderRadius: '50%',
}}
onClick={(e) => handleMenuClick(e, project)}
>
{project.description}
</Typography>
<FontAwesomeIcon icon={faGear} />
</IconButton>
</div>
<h3 style={{ marginTop: 0 }}>{project.title}</h3>
<Divider style={{ marginTop: "1rem", marginBottom: "10px" }} />
<Typography
variant="body2"
style={{
fontStyle: "italic",
margin: 0,
marginTop: "-10px",
}}
>
{project.description}
</Typography>

<div style={{ marginTop: '1rem' }}>
<Button
Expand Down Expand Up @@ -118,7 +118,6 @@ const ProjectList = ({ projects }) => {
))}
</Grid>

{/* Menu for project options */}
<Menu
anchorEl={anchorEl}
open={Boolean(anchorEl)}
Expand Down
6 changes: 0 additions & 6 deletions src/components/Project/ProjectHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,8 @@ class ProjectHome extends Component {
this.handleMessages(this.props.message, type);
}

<<<<<<< Updated upstream
componentDidUpdate(props) {
console.log(this.props.message);
if (props.location.pathname !== this.props.location.pathname) {
=======
componentDidUpdate(prevProps) {
if (prevProps.location.pathname !== this.props.location.pathname) {
>>>>>>> Stashed changes
this.setState({ snackbar: false });
this.props.getProjects(this.props.location.pathname.replace("/", ""));
}
Expand Down
36 changes: 26 additions & 10 deletions src/components/User/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,33 @@ export class Account extends Component {

render() {
const { user } = this.props;
const { classroomUser } = this.props;
var userAccount = null;
if (!user) {
userAccount = { classroomUser};
}
else {
userAccount = user;
}
console.log(userAccount);
return (
<div>
<Breadcrumbs content={[{ link: '/user', title: 'Account' }]} />

<h1>Account</h1>
{user ? (
<Alert>
Alle Angaben stammen von <Link
color='primary'
rel="noreferrer"
target="_blank"
href={'https://opensensemap.org/'}
underline="hover">openSenseMap</Link> und können dort verwaltet werden.
</Alert>
</Alert>) : null}
{classroomUser ? (
<Alert>
Classroom User
</Alert>) : null}
<Paper style={{ width: 'max-content', maxWidth: '100%' }}>
<List>
<ListItem>
Expand All @@ -45,9 +59,10 @@ export class Account extends Component {
<FontAwesomeIcon icon={faUser} />
</ListItemIcon>
</Tooltip>
<ListItemText primary={`Name: ${user.name}`} />
{user? <ListItemText primary={`Name: ${user.name}`} /> : classroomUser ? <ListItemText primary={`Name: ${classroomUser.name}`} /> : null}

</ListItem>
<ListItem>
{/* <ListItem>
<Tooltip title='Email'>
<ListItemIcon>
<FontAwesomeIcon icon={faAt} />
Expand All @@ -60,12 +75,12 @@ export class Account extends Component {
<FontAwesomeIcon icon={faUserTag} />
</ListItemIcon>
<ListItemText primary={`Userrolle: ${user.blocklyRole}`} />
</ListItem>
</ListItem> */}
</List>
</Paper>
<Divider style={{ marginBottom: '16px', marginTop: '16px' }} />
<div style={{ marginBottom: '8px' }}>
{this.props.user.boxes.length < 1 ?
{/* <div style={{ marginBottom: '8px' }}>
{userAccount.boxes.length < 1 ?
<Typography>
Du hast noch keine senseBox registriert. Besuche <Link
color='primary'
Expand All @@ -77,8 +92,8 @@ export class Account extends Component {
: <Typography style={{ fontWeight: 'bold', fontSize: '1.1rem' }}>
Du hast {this.props.user.boxes.length} {this.props.user.boxes.length === 1 ? 'senseBox' : 'senseBoxen'} registriert:
</Typography>}
</div>
<Grid container spacing={2}>
</div> */}
{/* <Grid container spacing={2}>
{this.props.user.boxes.map((box, i) => {
var sensors = box.sensors.map(sensor => sensor.title);
return (
Expand Down Expand Up @@ -134,11 +149,11 @@ export class Account extends Component {
</Grid>
);
})}
</Grid>
<Typography style={{ fontWeight: 'bold', fontSize: '1.1rem' }}>
Du hast {this.props.user.boxes.length} {this.props.user.boxes.length === 1 ? 'senseBox' : 'senseBoxen'} registriert:
</Typography>
</Grid>

</Grid> */}
</div>
);
}
Expand All @@ -151,6 +166,7 @@ Account.propTypes = {

const mapStateToProps = state => ({
user: state.auth.user,
classroomUser: state.classroomAuth.classroomUser,
});

export default connect(mapStateToProps, null)(Account);