-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from codeformuenster/update-dez
Show details for our map items on click
- Loading branch information
Showing
26 changed files
with
205 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
div.properties { | ||
margin-top:20px; | ||
} | ||
|
||
div.properties span { | ||
display:block; | ||
margin-top:3px; | ||
} | ||
div.properties span i { | ||
font-weight:bold; | ||
} | ||
|
||
.detailedItem { | ||
width:100%; | ||
height:100% | ||
} | ||
|
||
.closeBtn { | ||
margin-right:-10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
import * as React from 'react'; | ||
// import { SearchResults } from './SearchResults/SearchResults'; | ||
import { ISearchParams, ISearchResult } from '../App'; | ||
import './SearchResultDetailled.css'; | ||
|
||
interface ISearchResultDetailledProps { | ||
result: ISearchResult; | ||
updateHandler: any; | ||
searchParams: ISearchParams; | ||
} | ||
|
||
class SearchResultDetailled extends React.Component<ISearchResultDetailledProps, any> { | ||
|
||
render() { | ||
console.log('Rendering pool search result'); | ||
|
||
const result = this.props.result; | ||
console.log('Detailled result:', result); | ||
|
||
return ( | ||
<article | ||
key={result.id} | ||
className="notification detailedItem" | ||
> | ||
<div className="media"> | ||
<div className="media-left"> | ||
<p> | ||
<span className="icon is-large"> | ||
<i className="mdi mdi-48px mdi-calendar-text"></i> | ||
</span> | ||
</p> | ||
<div className="distanceDiv has-text-centered"> | ||
<span className="tag is-white">{this.distancePrettifier(result.distance)}</span> | ||
</div> | ||
</div> | ||
<div className="media-content"> | ||
<div className="content"> | ||
<div className="pull-right closeBtn"> | ||
<button onClick={e => this.toggleSelection()} className="delete" aria-label="delete"></button> | ||
</div> | ||
<span className="title"> | ||
<span>{result.name} </span> | ||
<span className="tag is-dark">{result.type}</span> | ||
</span> | ||
<div className="is-clearfix"> | ||
|
||
{result.url && ( | ||
<a href={result.url} target="_blank"> | ||
<span className="icon is-large"> | ||
<i className="mdi mdi-16px mdi-web"></i> | ||
</span> | ||
Webseite besuchen | ||
</a> | ||
)} | ||
|
||
{result.dateStart && ( | ||
<div> | ||
<p className="has-text-danger"> | ||
<span className="icon"> | ||
<i className="mdi mdi-timetable"></i> | ||
</span> | ||
Startdatum: {this.toHumanReadableDate(result.dateStart)} | ||
</p> | ||
<p className="has-text-danger"> | ||
<span className="icon"> | ||
<i className="mdi mdi-timetable"></i> | ||
</span> | ||
Enddatum: {result.dateEnd ? this.toHumanReadableDate(result.dateEnd) : 'unbekannt'} | ||
</p> | ||
</div> | ||
)} | ||
|
||
<div className="properties"> | ||
<span><i>Typ:</i> {this.props.result.type}</span> | ||
{this.renderProperties(result.properties)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</article> | ||
); | ||
} | ||
|
||
componentDidMount () { | ||
window.scrollTo(0, 0); | ||
} | ||
|
||
protected isoDateStringToDate(date: string): any { | ||
return new Date(Date.parse(date)); | ||
} | ||
|
||
protected toHumanReadableDate(date: any): string { | ||
return this.isoDateStringToDate(date).toLocaleDateString('de-DE'); | ||
} | ||
|
||
protected distancePrettifier(dist: number): string { | ||
return '' + Math.round(dist) + 'm'; | ||
} | ||
|
||
protected getMinutesByFeet(dist: number): string { | ||
return Math.round(dist / 80) + ' Min.'; | ||
} | ||
|
||
protected getMinutesByCar(dist: number): string { | ||
return Math.round(dist / 250) + ' Min.'; | ||
} | ||
|
||
protected isRunning(wlanStatus: string): boolean { | ||
return wlanStatus === 'in Bearbeitung'; | ||
} | ||
|
||
private capitalizeFirstLetter(str: string) { | ||
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); | ||
} | ||
|
||
private renderProperties(properties: any) { | ||
const response = []; | ||
|
||
for (const key in properties) { | ||
if (key) { | ||
switch (key.toLowerCase()) { | ||
case 'rechtswert': | ||
case 'hochwert': | ||
case 'kita_id': | ||
case 'e_name': | ||
case 'rechts': | ||
case 'lfdnr': | ||
case 'hoch': | ||
case 'id': | ||
continue; | ||
default: | ||
} | ||
response.push(<span><i>{this.capitalizeFirstLetter(key)}:</i> {properties[key]}</span>); | ||
} | ||
} | ||
return response; | ||
} | ||
|
||
private toggleSelection() { | ||
const sp = this.props.searchParams; | ||
sp.selectedId = 0; | ||
this.props.updateHandler(sp); | ||
} | ||
} | ||
|
||
export default SearchResultDetailled; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/Components/SearchResults/SearchResultsConstruction.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.