Skip to content

Commit 515afe3

Browse files
authored
Merge pull request #70 from go-spatial/url-prefix
added baseURI config option and functionality
2 parents 7efe5a4 + 5735c2a commit 515afe3

File tree

7 files changed

+41
-53
lines changed

7 files changed

+41
-53
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,31 @@ Fresco may be used in the browser by visiting [https://fresco.gospatial.org/](ht
2525

2626
## Running from source
2727

28-
Fresco is built on top of React. To run Freco from source use the following steps:
28+
Fresco is built on top of React. To run Fresco from source use the following steps:
2929

3030
1. Download the latest version of [Node.js](https://nodejs.org/en/download/)
3131
2. Clone this repository to your computer
3232
3. Navigate to this repo on your computer
3333
4. Run `npm install`
3434
5. To startup, run `npm start` - Fresco should open in a browser window
35+
6. To build Fresco for deployment run `npm run build` - the deployment files will be inside the `/build` directoty
36+
37+
## Hosting Fresco from a subdirectory
38+
39+
Fresco is able to be hosted from a subdirectory of a domain (i.e. https://yourhost.com/fresco/). To enable this functionality, modify the `package.json` file
40+
41+
42+
```
43+
{
44+
"name": "fresco-app",
45+
"version": "0.1.0",
46+
"private": true,
47+
"homepage": "/fresco",
48+
...
49+
50+
```
51+
52+
Then use `npm run build` to build Fresco for deployment.
3553

3654
## Contributing
3755

public/index.html

Lines changed: 2 additions & 24 deletions
Large diffs are not rendered by default.

public/vendor/jquery-3.2.1/jquery.slim.min.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/vendor/popper-1.12.29/popper.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ import './App.css';
1616
export default class App extends Component {
1717

1818
render (){
19-
Mconfig.load();
19+
Mconfig.load(); // load config from localStorage
20+
21+
const basename = process.env.PUBLIC_URL? process.env.PUBLIC_URL: '';
22+
2023
return (
2124
<Provider store={Store}>
22-
<Router>
25+
<Router basename={basename}>
2326
<Switch>
24-
<Route exact path="/" component={Phome}/>
2527
<Route path="/config" component={Pconfig}/>
2628
<Route path="/style/:id" render={(props) => <Pstyle {...props} />}/>
2729
<Route path="/add" component={Phome}/>
30+
<Route path="/" component={Phome}/>
2831
</Switch>
2932
</Router>
3033
</Provider>

src/model/Mconfig.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export default {
2626
save:function(){
2727
return new Promise((resolve,reject)=>{
2828
const config = this.get();
29-
console.log('config save:',config);
3029
LocalStorage.set(LOCALSTORAGE_KEY,config);
3130
return resolve();
3231
});

src/view/Vnav/index.jsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,20 @@ export default class Vnav extends React.Component {
1212
styles:'/',
1313
config:'/config'
1414
}
15-
16-
/*
17-
18-
*/
19-
15+
2016
return <nav className="navbar navbar-expand-lg navbar-light bg-light">
2117
<div className="container-fluid">
2218
<Link to={paths.home} className="navbar-brand">
23-
<img src="/img/icon.png" width="30" height="30" className="d-inline-block align-top" alt=""/>
19+
<img src={`${process.env.PUBLIC_URL}/img/icon.png`} width="30" height="30" className="d-inline-block align-top" alt=""/>
2420
</Link>
25-
<button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
26-
<span className="navbar-toggler-icon"></span>
27-
</button>
28-
<div className="collapse navbar-collapse">
29-
<ul className="navbar-nav">
30-
<li className="nav-item">
31-
<NavLink to={paths.config} className="nav-link" activeClassName="active">
32-
config
33-
</NavLink>
34-
</li>
35-
</ul>
36-
</div>
21+
22+
<ul className="navbar-nav">
23+
<li className="nav-item">
24+
<NavLink to={paths.config} className="nav-link" activeClassName="active">
25+
config
26+
</NavLink>
27+
</li>
28+
</ul>
3729
</div>
3830
</nav>
3931

0 commit comments

Comments
 (0)