parent
dd6d5ab18a
commit
00f4e7a8b9
web/src/components/main
@ -1,4 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { Container, Card, Grid, Button } from 'semantic-ui-react';
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import actions from '../../../actions';
|
||||
@ -27,6 +28,7 @@ export default function Explore() {
|
||||
|
||||
return (
|
||||
<Container style={{ marginTop: '40px' }}>
|
||||
<Helmet title='Explore' />
|
||||
<Grid stackable>
|
||||
<Grid.Column computer={5} tablet={8}>
|
||||
<DiscoverCard asCard count={7} />
|
||||
|
@ -73,11 +73,8 @@ function Project() {
|
||||
{project.visibility === 'private' && <span data-tooltip="This project is private" data-position="right center"><Icon name="lock" /></span>}
|
||||
{project.name}
|
||||
</Card.Header>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<div>
|
||||
{project.owner && <UserChip user={project.owner} />}
|
||||
{utils.canEditProject(user, project) &&
|
||||
<Button basic size='mini' icon='cogs' content='Settings' as={Link} to={`/${fullName}/settings`} />
|
||||
}
|
||||
</div>
|
||||
</Card.Content>
|
||||
<Card.Content extra>
|
||||
@ -99,11 +96,14 @@ function Project() {
|
||||
</div>
|
||||
}
|
||||
{utils.canEditProject(user, project) && (
|
||||
<Button size='mini' fluid className="right floated" onClick={e => dispatch(actions.projects.editDescription(true))}>
|
||||
<Button style={{ marginBottom: '5px' }} size='mini' fluid onClick={e => dispatch(actions.projects.editDescription(true))}>
|
||||
<Icon name="pencil" /> {project.description ? 'Edit' : 'Add a project'} description
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
{utils.canEditProject(user, project) &&
|
||||
<Button basic fluid size='mini' icon='cogs' content='Project settings' as={Link} to={`/${fullName}/settings`} />
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ function DraftPreview({ object }) {
|
||||
const baseSize = 6;
|
||||
const canvas = document.createElement('canvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
canvas.width = warp.threads * baseSize + weft.treadles * baseSize + 20;
|
||||
canvas.height = warp.shafts * baseSize + weft.threads * baseSize + 20;
|
||||
canvas.width = warp.threading?.length * baseSize + weft.treadles * baseSize + 20;
|
||||
canvas.height = warp.shafts * baseSize + weft.treadling?.length * baseSize + 20;
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.fillStyle = 'black';
|
||||
@ -62,7 +62,11 @@ function DraftPreview({ object }) {
|
||||
ctx.drawImage(weftColourwayCanvas, canvas.width - 10, warp.shafts * baseSize + 20);
|
||||
ctx.drawImage(tieupsCanvas, canvas.width - weft.treadles * baseSize - 10, 10);
|
||||
ctx.drawImage(drawdownCanvas, canvas.width - drawdownCanvas.width - weft.treadles * baseSize - 20, warp.shafts * baseSize + 20);
|
||||
dispatch(actions.objects.update(objectId, 'patternImage', canvas.toDataURL()));
|
||||
setTimeout(() => {
|
||||
const im = canvas.toDataURL('image/png')
|
||||
if (im?.length > 20)
|
||||
dispatch(actions.objects.update(objectId, 'patternImage', im));
|
||||
}, 500);
|
||||
}
|
||||
}, 500);
|
||||
}, [dispatch, objectId, pattern]);
|
||||
|
Loading…
Reference in New Issue
Block a user