Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Property for Mastodon Profile URL #551

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/Ticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
twitter: string
facebook: string
telegram: string
mastodon: string
}

export interface TickerTelegram {
Expand Down Expand Up @@ -77,7 +78,7 @@
'Content-Type': 'application/json',
}

const deleteTicker = (ticker: Ticker): Promise<Response<any>> => {

Check warning on line 81 in src/api/Ticker.ts

View workflow job for this annotation

GitHub Actions / ESLint Results

src/api/Ticker.ts#L81

Unexpected any. Specify a different type (@typescript-eslint/no-explicit-any)
return fetch(`${ApiUrl}/admin/tickers/${ticker.id}`, {
headers: headers,
method: 'delete',
Expand All @@ -90,7 +91,7 @@
}).then(response => response.json())
}

const deleteTickerUser = (ticker: Ticker, user: User): Promise<Response<any>> => {

Check warning on line 94 in src/api/Ticker.ts

View workflow job for this annotation

GitHub Actions / ESLint Results

src/api/Ticker.ts#L94

Unexpected any. Specify a different type (@typescript-eslint/no-explicit-any)
return fetch(`${ApiUrl}/admin/tickers/${ticker.id}/users/${user.id}`, {
headers: headers,
method: 'delete',
Expand All @@ -105,7 +106,7 @@
return fetch(`${ApiUrl}/admin/tickers/${id}`, { headers: headers }).then(response => response.json())
}

const postTicker = (data: any): Promise<Response<TickerResponseData>> => {

Check warning on line 109 in src/api/Ticker.ts

View workflow job for this annotation

GitHub Actions / ESLint Results

src/api/Ticker.ts#L109

Unexpected any. Specify a different type (@typescript-eslint/no-explicit-any)
return fetch(`${ApiUrl}/admin/tickers`, {
headers: headers,
body: JSON.stringify(data),
Expand All @@ -113,7 +114,7 @@
}).then(response => response.json())
}

const putTicker = (data: any, id: number): Promise<Response<TickerResponseData>> => {

Check warning on line 117 in src/api/Ticker.ts

View workflow job for this annotation

GitHub Actions / ESLint Results

src/api/Ticker.ts#L117

Unexpected any. Specify a different type (@typescript-eslint/no-explicit-any)
return fetch(`${ApiUrl}/admin/tickers/${id}`, {
headers: headers,
body: JSON.stringify(data),
Expand Down
20 changes: 19 additions & 1 deletion src/components/ticker/TickerForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MapContainer, Marker, TileLayer } from 'react-leaflet'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { Alert, Button, Checkbox, FormControlLabel, FormGroup, Grid, InputAdornment, Stack, TextField, Typography } from '@mui/material'
import { faComputerMouse, faEnvelope, faUser } from '@fortawesome/free-solid-svg-icons'
import { faFacebook, faTelegram, faTwitter } from '@fortawesome/free-brands-svg-icons'
import { faFacebook, faMastodon, faTelegram, faTwitter } from '@fortawesome/free-brands-svg-icons'

interface Props {
id: string
Expand All @@ -28,6 +28,7 @@ interface FormValues {
twitter: string
facebook: string
telegram: string
mastodon: string
}
location: {
lat: number
Expand All @@ -49,6 +50,7 @@ const TickerForm: FC<Props> = ({ callback, id, ticker }) => {
twitter: ticker?.information.twitter,
facebook: ticker?.information.facebook,
telegram: ticker?.information.telegram,
mastodon: ticker?.information.mastodon,
},
location: {
lat: ticker?.location.lat || 0,
Expand Down Expand Up @@ -224,6 +226,22 @@ const TickerForm: FC<Props> = ({ callback, id, ticker }) => {
/>
</FormGroup>
</Grid>
<Grid item sm={6} xs={12}>
<FormGroup>
<TextField
{...register('information.mastodon')}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<FontAwesomeIcon icon={faMastodon} />
</InputAdornment>
),
}}
label="Mastodon"
margin="dense"
/>
</FormGroup>
</Grid>
<Grid item xs={12}>
<Typography component="h6" variant="h6">
Location
Expand Down
Loading