From 90475b988ba83202748f12b5c03f45c594c02d64 Mon Sep 17 00:00:00 2001 From: HoshinoSuzumi Date: Mon, 15 Apr 2024 12:12:32 +0800 Subject: [PATCH] feat: Sighting and Transmitters filter feat: renamed 'data' button fix: wrong key on list --- app/satellites/SatelliteTable.tsx | 341 ++++++++++++++++++++++++++--- components/Icon/TablerAngle.tsx | 10 + components/Icon/TablerClock.tsx | 12 + components/Icon/TablerRoute.tsx | 10 + components/Icon/TablerWaveSine.tsx | 10 + package-lock.json | 4 +- 6 files changed, 360 insertions(+), 27 deletions(-) create mode 100644 components/Icon/TablerAngle.tsx create mode 100644 components/Icon/TablerClock.tsx create mode 100644 components/Icon/TablerRoute.tsx create mode 100644 components/Icon/TablerWaveSine.tsx diff --git a/app/satellites/SatelliteTable.tsx b/app/satellites/SatelliteTable.tsx index 955825b..cbba387 100644 --- a/app/satellites/SatelliteTable.tsx +++ b/app/satellites/SatelliteTable.tsx @@ -7,11 +7,15 @@ import { CSSProperties, ReactNode, useEffect, useState } from 'react' import { Icon } from '@iconify-icon/react' import { noto_sc, rubik } from '@/app/fonts' import { IconSpinner } from '@/components/Icon/IconSpinner' -import { Button, SideSheet } from '@douyinfe/semi-ui' +import { Button, Select, SideSheet, Tooltip } from '@douyinfe/semi-ui' import useSWR, { SWRConfig } from 'swr' import { ObserverLocationStore, SatelliteSighting } from '@/types/types' import Image from 'next/image' import { TransponderCard } from '@/app/satellites/TransponderCard' +import { TablerAngle } from '@/components/Icon/TablerAngle' +import { TablerClock } from '@/components/Icon/TablerClock' +import { TablerWaveSine } from '@/components/Icon/TablerWaveSine' +import { TablerRoute } from '@/components/Icon/TablerRoute' const NationalFlag = ({ countries }: { countries: string }) => { const countriesList = countries.split(',') @@ -114,13 +118,229 @@ const SatelliteTableRow = ({ ? Buffer.from(str).toString('base64') : window.btoa(str) - const SideLoadingPlaceholder = ({ text, className }: { text: string, className?: string }) => ( + const SideLoadingPlaceholder = ({ + text, + loading = true, + className, + }: { + text: string, + loading?: boolean + className?: string + }) => (
- + { loading && }

{ text }

) + const transmitterModes = [ + { + 'value': 90, + 'label': '4FSK', + }, + { + 'value': 49, + 'label': 'AFSK', + }, + { + 'value': 78, + 'label': 'AFSK TUBiX10', + }, + { + 'value': 17, + 'label': 'AHRPT', + }, + { + 'value': 19, + 'label': 'AM', + }, + { + 'value': 44, + 'label': 'APT', + }, + { + 'value': 93, + 'label': 'ASK', + }, + { + 'value': 50, + 'label': 'BPSK', + }, + { + 'value': 83, + 'label': 'BPSK PMT-A3', + }, + { + 'value': 59, + 'label': 'CERTO', + }, + { + 'value': 6, + 'label': 'CW', + }, + { + 'value': 95, + 'label': 'DBPSK', + }, + { + 'value': 96, + 'label': 'DOKA', + }, + { + 'value': 97, + 'label': 'DPSK', + }, + { + 'value': 71, + 'label': 'DQPSK', + }, + { + 'value': 98, + 'label': 'DSB', + }, + { + 'value': 57, + 'label': 'DSTAR', + }, + { + 'value': 58, + 'label': 'DUV', + }, + { + 'value': 92, + 'label': 'DVB-S2', + }, + { + 'value': 82, + 'label': 'FFSK', + }, + { + 'value': 1, + 'label': 'FM', + }, + { + 'value': 7, + 'label': 'FMN', + }, + { + 'value': 72, + 'label': 'FSK', + }, + { + 'value': 84, + 'label': 'FSK AX.100 Mode 5', + }, + { + 'value': 85, + 'label': 'FSK AX.100 Mode 6', + }, + { + 'value': 88, + 'label': 'FSK AX.25 G3RUH', + }, + { + 'value': 75, + 'label': 'GFSK', + }, + { + 'value': 68, + 'label': 'GFSK Rktr', + }, + { + 'value': 94, + 'label': 'GFSK/BPSK', + }, + { + 'value': 63, + 'label': 'GMSK', + }, + { + 'value': 91, + 'label': 'GMSK USP', + }, + { + 'value': 45, + 'label': 'HRPT', + }, + { + 'value': 89, + 'label': 'LoRa', + }, + { + 'value': 53, + 'label': 'LRPT', + }, + { + 'value': 20, + 'label': 'LSB', + }, + { + 'value': 77, + 'label': 'MFSK', + }, + { + 'value': 81, + 'label': 'MSK', + }, + { + 'value': 86, + 'label': 'MSK AX.100 Mode 5', + }, + { + 'value': 87, + 'label': 'MSK AX.100 Mode 6', + }, + { + 'value': 61, + 'label': 'OFDM', + }, + { + 'value': 76, + 'label': 'OQPSK', + }, + { + 'value': 74, + 'label': 'PSK', + }, + { + 'value': 40, + 'label': 'PSK31', + }, + { + 'value': 41, + 'label': 'PSK63', + }, + { + 'value': 69, + 'label': 'QPSK', + }, + { + 'value': 42, + 'label': 'QPSK31', + }, + { + 'value': 43, + 'label': 'QPSK63', + }, + { + 'value': 5, + 'label': 'SSTV', + }, + { + 'value': 9, + 'label': 'USB', + }, + { + 'value': 64, + 'label': 'WSJT', + }, + ] + + const [sightHours, setSightHours] = useState(24) + const [sightElevation, setSightElevation] = useState(10) + const [transmitterMode, setTransmitterMode] = useState(0) + const [transmitterService, setTransmitterService] = useState('Amateur') + const { data: sightingData, isLoading: isSightingLoading, @@ -135,8 +355,8 @@ const SatelliteTableRow = ({ tle0: tle?.tle0, tle1: tle?.tle1, tle2: tle?.tle2, - hours: 24, - elevation_threshold: 10, + hours: sightHours, + elevation_threshold: sightElevation, observer: { lat: location?.latitude || 0, lon: location?.longitude || 0, @@ -150,7 +370,7 @@ const SatelliteTableRow = ({ data: transmittersData, isLoading: isTransmittersLoading, } = useSWR>(sidePopVisible && { - resource: `/api/satellite/satnogs/${ encodeURIComponent(`transmitters/?format=json&service=Amateur&sat_id=${ satellite.sat_id }`) }`, + resource: `/api/satellite/satnogs/${ encodeURIComponent(`transmitters/?format=json${ transmitterService === 'all' ? '' : '&service=' + transmitterService }&alive=true&satellite__norad_cat_id=${ satellite.norad_cat_id }${ transmitterMode !== 0 ? '&mode=' + transmitterMode : '' }`) }`, }, { refreshWhenHidden: false, refreshWhenOffline: false, @@ -198,10 +418,10 @@ const SatelliteTableRow = ({ @@ -280,14 +500,43 @@ const SatelliteTableRow = ({ : ( <> -

- - 未来 24 小时过境 -

+
+

+ + 未来过境 +

+
+ + + + +
+
- { (sightingData && typeof sightingData.length === 'number') && sightingData.map((sighting, index) => ( + { (sightingData && typeof sightingData.length === 'number' && sightingData.length > 0) ? sightingData.map((sighting, index) => (
- )) } + )) : ( + + ) } ) } @@ -349,16 +600,56 @@ const SatelliteTableRow = ({ : ( <> -

- - 卫星收发器 -

+
+

+ + 卫星收发器 +

+
+ + setTransmitterService(value as string) } + prefix={ } + position={ 'bottomRight' } + /> + +
+
- { transmittersData?.data && transmittersData.data.map(transponder => ( - - )) } + { (transmittersData?.data && transmittersData.data.length > 0) ? transmittersData.data.map(transponder => ( + + )) : ( + + ) }
) } diff --git a/components/Icon/TablerAngle.tsx b/components/Icon/TablerAngle.tsx new file mode 100644 index 0000000..60236d8 --- /dev/null +++ b/components/Icon/TablerAngle.tsx @@ -0,0 +1,10 @@ +import { SVGProps } from 'react' + +export function TablerAngle(props: SVGProps) { + return ( + + + + ) +} \ No newline at end of file diff --git a/components/Icon/TablerClock.tsx b/components/Icon/TablerClock.tsx new file mode 100644 index 0000000..794f59d --- /dev/null +++ b/components/Icon/TablerClock.tsx @@ -0,0 +1,12 @@ +import { SVGProps } from 'react' + +export function TablerClock(props: SVGProps) { + return ( + + + + + + + ) +} \ No newline at end of file diff --git a/components/Icon/TablerRoute.tsx b/components/Icon/TablerRoute.tsx new file mode 100644 index 0000000..1c6a140 --- /dev/null +++ b/components/Icon/TablerRoute.tsx @@ -0,0 +1,10 @@ +import { SVGProps } from 'react' + +export function TablerRoute(props: SVGProps) { + return ( + + + + ) +} \ No newline at end of file diff --git a/components/Icon/TablerWaveSine.tsx b/components/Icon/TablerWaveSine.tsx new file mode 100644 index 0000000..6e81dc1 --- /dev/null +++ b/components/Icon/TablerWaveSine.tsx @@ -0,0 +1,10 @@ +import { SVGProps } from 'react' + +export function TablerWaveSine(props: SVGProps) { + return ( + + + + ) +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e662f46..04cad2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ham-set", - "version": "0.2.0", + "version": "0.3.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ham-set", - "version": "0.2.0", + "version": "0.3.2", "dependencies": { "@douyinfe/semi-icons": "^2.54.1", "@douyinfe/semi-illustrations": "^2.54.1",