-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Starting point for new firecallitem base class * Extend baseclass * Dockerfile and devcontainer * Update rendering * Rewerite components * Add login page before rendering any other pages * Add about to login page * Use a page to switch firecalls * Add diary * Add progress * Add polyline check
- Loading branch information
Showing
40 changed files
with
1,937 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node | ||
{ | ||
"name": "Node.js & TypeScript", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [3000] | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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,112 @@ | ||
import L, { Icon, IconOptions } from 'leaflet'; | ||
import { ReactNode } from 'react'; | ||
import { Circle as LeafletCircle } from 'react-leaflet'; | ||
import { Circle, FirecallItem } from '../../firebase/firestore'; | ||
import { circleIcon } from '../icons'; | ||
import { FirecallItemBase } from './FirecallItemBase'; | ||
|
||
export class CircleMarker extends FirecallItemBase { | ||
color: string; | ||
radius: number; | ||
opacity: number; | ||
fill: string; | ||
|
||
public constructor(firecallItem?: Circle) { | ||
super(firecallItem); | ||
this.color = firecallItem?.color || 'green'; | ||
this.radius = firecallItem?.radius || 50; | ||
this.opacity = firecallItem?.opacity || 100; | ||
this.fill = firecallItem?.fill === undefined ? 'true' : firecallItem.fill; | ||
} | ||
|
||
public data(): FirecallItem { | ||
return { | ||
...super.data(), | ||
color: this.color, | ||
radius: this.radius, | ||
opacity: this.opacity, | ||
fill: this.fill, | ||
} as Circle; | ||
} | ||
|
||
public markerName(): string { | ||
return `Kreis`; | ||
} | ||
|
||
public title(): string { | ||
return `${this.markerName()} ${this.name}`; | ||
} | ||
public info(): string { | ||
return `Radius: ${this.radius || 0}m`; | ||
} | ||
|
||
public body(): string { | ||
return `${this.lat},${this.lng}\nUmkreis: ${this.radius || 0}m`; | ||
} | ||
|
||
public dialogText(): ReactNode { | ||
return ( | ||
<> | ||
Um die Kreis zu zeichnen, auf die gewünschten Positionen klicken. <br /> | ||
{this.name || ''} | ||
</> | ||
); | ||
} | ||
|
||
public fields(): { [fieldName: string]: string } { | ||
return { | ||
...super.fields(), | ||
radius: 'Radius (m)', | ||
color: 'Farbe (HTML bzw. Englisch)', | ||
fill: 'Kreis ausfüllen', | ||
opacity: 'Deckkraft (in Prozent)', | ||
}; | ||
} | ||
|
||
public dateFields(): string[] { | ||
return []; | ||
} | ||
|
||
public fieldTypes(): { [fieldName: string]: string } { | ||
return { | ||
fill: 'boolean', | ||
}; | ||
} | ||
public popupFn(): ReactNode { | ||
return ( | ||
<> | ||
<b>Kreis {this.name}</b> | ||
<br /> | ||
{this.radius || 0}m | ||
</> | ||
); | ||
} | ||
public titleFn(): string { | ||
return `Kreis ${this.name}: Radius ${this.radius || 0}m`; | ||
} | ||
public icon(): Icon<IconOptions> { | ||
return circleIcon; | ||
} | ||
|
||
public static factory(): FirecallItemBase { | ||
return new CircleMarker(); | ||
} | ||
|
||
public renderMarker(selectItem: (item: FirecallItem) => void) { | ||
return ( | ||
<> | ||
{super.renderMarker(selectItem)} | ||
<LeafletCircle | ||
key={'circle' + this.id} | ||
color={this.color} | ||
radius={this.radius} | ||
center={L.latLng(this.lat, this.lng)} | ||
opacity={this.opacity / 100} | ||
fill={this.fill === 'true'} | ||
> | ||
{this.renderPopup(selectItem)} | ||
</LeafletCircle> | ||
</> | ||
); | ||
} | ||
} |
Oops, something went wrong.