link id to 5 digits
This commit is contained in:
		
							parent
							
								
									89a5c838bf
								
							
						
					
					
						commit
						57142dc8a1
					
				| @ -4,6 +4,7 @@ import { connect } from "react-redux"; | |||||||
| import { shareProject } from "../../actions/projectActions"; | import { shareProject } from "../../actions/projectActions"; | ||||||
| import { clearMessages } from "../../actions/messageActions"; | import { clearMessages } from "../../actions/messageActions"; | ||||||
| import QRCode from 'qrcode.react'; | import QRCode from 'qrcode.react'; | ||||||
|  | import { createId } from "mnemonic-id"; | ||||||
| 
 | 
 | ||||||
| import moment from "moment"; | import moment from "moment"; | ||||||
| 
 | 
 | ||||||
| @ -135,7 +136,7 @@ class WorkspaceFunc extends Component { | |||||||
|     const requestOptions = { |     const requestOptions = { | ||||||
|       method: 'POST', |       method: 'POST', | ||||||
|       headers: { 'Content-Type': 'application/json' }, |       headers: { 'Content-Type': 'application/json' }, | ||||||
|       body: JSON.stringify({ "slug": `blockly-${id}`, "url": `${window.location.origin}/share/${id}` }) |       body: JSON.stringify({ "slug": `blockly-${createId(5)}`, "url": `${window.location.origin}/share/${id}` }) | ||||||
|     }; |     }; | ||||||
|     fetch('https://www.snsbx.de/api/shorty', requestOptions) |     fetch('https://www.snsbx.de/api/shorty', requestOptions) | ||||||
|         .then(response => response.json()) |         .then(response => response.json()) | ||||||
| @ -191,11 +192,13 @@ class WorkspaceFunc extends Component { | |||||||
|                 <Typography> |                 <Typography> | ||||||
|                   Über den folgenden Link kannst du dein Programm teilen: |                   Über den folgenden Link kannst du dein Programm teilen: | ||||||
|                 </Typography> |                 </Typography> | ||||||
|  |                 <div style={{ textAlign: "center" }}> | ||||||
|                   <a |                   <a | ||||||
|                     href={this.state.shortLink} |                     href={this.state.shortLink} | ||||||
|                     onClick={() => this.toggleDialog()} |                     onClick={() => this.toggleDialog()} | ||||||
|                     className={this.props.classes.link} |                     className={this.props.classes.link} | ||||||
|                     target="_blank" |                     target="_blank" | ||||||
|  |                     rel="noreferrer" | ||||||
|                   >{this.state.shortLink}</a> |                   >{this.state.shortLink}</a> | ||||||
|                   <Tooltip |                   <Tooltip | ||||||
|                   title={Blockly.Msg.tooltip_copy_link} |                   title={Blockly.Msg.tooltip_copy_link} | ||||||
| @ -218,7 +221,8 @@ class WorkspaceFunc extends Component { | |||||||
|                       <FontAwesomeIcon icon={faCopy} size="xs" /> |                       <FontAwesomeIcon icon={faCopy} size="xs" /> | ||||||
|                     </IconButton> |                     </IconButton> | ||||||
|                   </Tooltip> |                   </Tooltip> | ||||||
|                 <div style={{ display: 'flex', justifyContent: 'center' }}> |                 </div>                 | ||||||
|  |                 <div style={{ marginTop: "10px", display: 'flex', justifyContent: 'center' }}> | ||||||
|                   <QRCode |                   <QRCode | ||||||
|                     id="qr-gen" |                     id="qr-gen" | ||||||
|                     value={this.state.shortLink} |                     value={this.state.shortLink} | ||||||
| @ -227,12 +231,7 @@ class WorkspaceFunc extends Component { | |||||||
|                     includeMargin={false} |                     includeMargin={false} | ||||||
|                   /> |                   /> | ||||||
|                 </div> |                 </div> | ||||||
|                 <div style={{ display: 'flex', justifyContent: 'center', marginTop: '10px'}}> |                 <div style={{ display: 'flex', justifyContent: 'center', marginTop: '20px'}}> | ||||||
|                   {/* <Tooltip title={Blockly.Msg.tooltip_download_qrcode} arrow> |  | ||||||
|                     <IconButton onClick={() => this.downloadQRCode()} className={`download QR Code ${this.props.classes.button}`}> |  | ||||||
|                       <FontAwesomeIcon icon={faDownload} size="xs" /> |  | ||||||
|                     </IconButton> |  | ||||||
|                   </Tooltip> */} |  | ||||||
|                   <Button className={`download QR Code ${this.props.classes.button}`} onClick={() => this.downloadQRCode()} variant="contained" startIcon={<FontAwesomeIcon icon={faDownload} size="xs" />}> |                   <Button className={`download QR Code ${this.props.classes.button}`} onClick={() => this.downloadQRCode()} variant="contained" startIcon={<FontAwesomeIcon icon={faDownload} size="xs" />}> | ||||||
|                     Download QR code |                     Download QR code | ||||||
|                   </Button> |                   </Button> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user