2020-08-02 19:17:06 +02:00
|
|
|
import React from 'react'
|
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import Workbench from '@freesewing/components/Workbench'
|
|
|
|
import '@freesewing/css-theme'
|
2021-05-22 18:01:25 +02:00
|
|
|
import Pattern from './pattern/src/index.js'
|
|
|
|
/*
|
|
|
|
* The following symlink is required to make this import work:
|
|
|
|
* `root_folder/example/src/pattern => `../../`
|
|
|
|
*
|
|
|
|
* Without it, we can't import the pattern as a local file
|
|
|
|
* since create-react-app does not allow imports outside ./src
|
|
|
|
* If it's imported as a dependency, webpack will cache the
|
|
|
|
* build and there will be no hot-relaoding of changes
|
|
|
|
*/
|
2020-08-02 19:17:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
const App = (props) => {
|
|
|
|
// You can use this to add transations
|
|
|
|
/*
|
|
|
|
let translations = {
|
|
|
|
JSON: 'JSON',
|
|
|
|
someOtherString: 'Some other string that needs translation'
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2020-11-15 17:30:56 +01:00
|
|
|
// Adds support for loading an external pattern configuration
|
2020-12-12 14:41:04 +01:00
|
|
|
let recreate = false
|
2020-11-18 20:30:14 +01:00
|
|
|
if (window) recreate = window.location.pathname.substr(1).split('/')
|
2020-12-12 14:41:04 +01:00
|
|
|
if (recreate.length === 3 && recreate[0] === 'recreate')
|
2020-11-18 20:30:14 +01:00
|
|
|
recreate = { from: recreate[1], id: recreate[2] }
|
2020-11-15 17:30:56 +01:00
|
|
|
else recreate = false
|
|
|
|
|
2020-08-02 19:17:06 +02:00
|
|
|
return (
|
|
|
|
<Workbench
|
|
|
|
freesewing={freesewing}
|
|
|
|
Pattern={Pattern}
|
|
|
|
userLanguage="en"
|
2020-11-15 17:30:56 +01:00
|
|
|
recreate={recreate}
|
2020-08-02 19:17:06 +02:00
|
|
|
//translations={translations}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App
|