Skip to content

Commit

Permalink
Normalize and fix paths to mp3, Images cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sawasawasawa committed Sep 10, 2017
1 parent 8fb2d78 commit 524c127
Show file tree
Hide file tree
Showing 54 changed files with 53 additions and 627 deletions.
7 changes: 7 additions & 0 deletions imports/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function normalizeString (string) {
return
}

export function normalizeStringToURLPath (string) {
return string.replace(/\.mp3/g, "").replace(/[^\x00-\x7F]/g, "_").replace(/\.|\//gi, '').replace(/^\s+|\s+$/gm, '').toLowerCase().replace(/ /g, "_").concat('.mp3');
}
1 change: 1 addition & 0 deletions imports/startup/server/fileRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Picker.route('/images/tmp/:filename', function (params, request, response, next)
response.end(data)
} catch (err) {
if (err.code === 'ENOENT') {
console.log("_______ filePath", filePath);
console.log('File not found! filename:', params.filename)
} else {
console.log('batman: error', error)
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/MusicMap/Markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export const Markers = (props) => {
enableRetinaIcons
gridSize={10}
zoomOnClick={false}
imagePath='img/resize/cluster'
imagePath='/img/cluster'
styles={[{
textColor: '#313131',
url: 'img/resize/cluster1.png',
url: '/img/cluster1.png',
height: 50,
width: 50
}]}
Expand Down
24 changes: 24 additions & 0 deletions imports/ui/components/Legend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, {Component} from 'react'
import Paper from 'material-ui/Paper'

export class LegendElement extends Component {
render () {
const style = {
height: 32,
width: 32,
padding: 2,
textAlign: 'center',
color: 'white',
boxShadow: 'black 0px 0px 0px 1px,white 0px 0px 0px 2px, rgba(0, 0, 0, 0.3) 0px 19px 60px, rgba(0, 0, 0, 0.22) 0px 15px 20px'
}

return (
<div style={{zIndex: 2, color: 'white', marginRight: '5px'}}>
<Paper style={style} zDepth={5} circle ><img src={this.props.image} width='24px' /></Paper>
<div style={{marginTop: '15px', marginRight: '8px', marginLeft: '5px'}}>{this.props.name}</div>
</div>
)
}
}

export default LegendElement
10 changes: 6 additions & 4 deletions imports/ui/components/common/PlaceMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class PlaceMarker extends Component {
getIconForMedia (record) {
const iconMap = {
youtubeVideo: '/img/youtube.svg',
mp3: '/img/resize/record.png'
mp3: '/img/record.png'
}
return iconMap[record.mediaType] || iconMap['mp3']
}
Expand All @@ -33,9 +33,11 @@ export default class PlaceMarker extends Component {
club: '/img/disco-ball.svg',
outdoorHall: '/img/outdoorHall.png',
pub: '/img/cafe.png',
tv: '/img/resize/tv.png',
radio: '/img/resize/radio.png',
culture: '/img/resize/culture.png'
tv: '/img/tv.png',
radio: '/img/radio.png',
theatre: '/img/theatre.png',
philharmonia: '/img/piano.png',
culture: '/img/culture.png'
}
return iconMap[place.type] || iconMap['culture']
}
Expand Down
10 changes: 5 additions & 5 deletions imports/ui/components/dialogs/AddMediaDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import MenuItem from 'material-ui/MenuItem'
import {Events} from '../../../api/events.js'
import TextInput from '../common/TextInput'
import PlaceSelect from '../common/PlaceSelect'
import { normalizeStringToURLPath } from "../../../helpers";

export default class AddMediaDialog extends React.Component {
state = {
Expand Down Expand Up @@ -41,14 +42,13 @@ export default class AddMediaDialog extends React.Component {
mediaObject.videoId = this.state.videoLink.replace(/http.*watch.*=/gi, '')
}

Meteor.call('addMedia', mediaObject)

if (this.state.mediaType === 'mp3' && this.state.mp3 && this.state.uploadedFile) {
mediaObject.mp3 = this.state.mp3
mediaObject.filename = this.state.filename
Meteor.call('uploadMp3File', this.state.mp3.name, this.state.uploadedFile)
const normalizedFileName = normalizeStringToURLPath(this.state.mp3.name)
mediaObject.filename = normalizedFileName
Meteor.call('uploadMp3File', normalizedFileName, this.state.uploadedFile)
}

Meteor.call('addMedia', mediaObject)
this.handleClose()
// TODO get rid of this reload by utilizing createContainer properly
// location.reload()
Expand Down
1 change: 0 additions & 1 deletion imports/ui/components/dialogs/MapVideoDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const MapVideoDialog = (props) => {
repositionOnUpdate={false}
autoScrollBodyContent
>
<h1>{video.name}</h1>
{video.youtubeId
? <YouTube key={video._id} videoId={video.youtubeId} opts={opts} />
: 'Coś poszło nie tak...'
Expand Down
11 changes: 6 additions & 5 deletions imports/ui/components/dialogs/Mp3Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ export const Mp3Dialog = (props) => {
repositionOnUpdate={false}
autoScrollBodyContent
>
<strong>Opis:&nbsp;</strong>
<span>{props.media.description || 'brak'}</span>
<br />
<br />

<audio controls>
<source src={`/images/tmp/${props.media.filename}`} type='audio/mp3' />
Your browser does not support the audio element.
</audio>

<br />
<br />

<strong>Opis:&nbsp;</strong>
<span>{props.media.description || 'brak'}</span>
</Dialog>
}
2 changes: 1 addition & 1 deletion imports/ui/components/dialogs/PlaceDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ const SocialIcons = (props) => {

const PlaceIcon = (props) => {
return <a href={props.href} target='_blank' style={{marginLeft: 10}}>
<img src={`/img/resize/${props.icon}.png`} width='32px' />
<img src={`/img/${props.icon}.png`} width='32px' />
</a>
}
Binary file removed public/img/beer.png
Binary file not shown.
41 changes: 0 additions & 41 deletions public/img/cassette-tape-with-black-border.svg

This file was deleted.

Binary file removed public/img/club.png
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file modified public/img/culture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 524c127

Please sign in to comment.