Skip to content

Commit

Permalink
fix: update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed May 24, 2024
1 parent 87bd42f commit 19560d4
Show file tree
Hide file tree
Showing 30 changed files with 70 additions and 63 deletions.
4 changes: 2 additions & 2 deletions src/chart/HistoryChart.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Size } from '#components/ResizeObserver.js'
import { chartMath, type ChartData } from './chartMath.js'
import { generateLabels } from './generateLabels.js'
import { chartMath, type ChartData } from '#chart/chartMath.js'
import { generateLabels } from '#chart/generateLabels.js'
import { useRef } from 'preact/hooks'

export const HistoryChart = ({
Expand Down
2 changes: 1 addition & 1 deletion src/chart/generateLabels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { subMinutes } from 'date-fns'
import type { chartMath, XAxis } from './chartMath.js'
import type { chartMath, XAxis } from '#chart/chartMath.js'

export const generateLabels = (
{ startDate }: ReturnType<typeof chartMath>,
Expand Down
4 changes: 2 additions & 2 deletions src/chart/toChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
type BatteryReading,
type BatteryReadings,
type GainReadings,
} from '../context/models/PCA20035-solar.js'
import { xAxisForType } from './xAxisForType.js'
} from '#context/models/PCA20035-solar.js'
import { xAxisForType } from '#chart/xAxisForType.js'

export const toChartData = ({
battery,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './buttons/Button.js'
export * from './buttons/ButtonlikeLink.js'
export * from '#components/buttons/Button.js'
export * from '#components/buttons/ButtonlikeLink.js'
2 changes: 1 addition & 1 deletion src/components/CountryFlag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mccmnc2country } from './mccmnc2country.js'
import { mccmnc2country } from '#components/mccmnc2country.js'

export const CountryFlag = ({
mccmnc,
Expand Down
23 changes: 13 additions & 10 deletions src/components/DeviceHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ import {
UploadCloud,
} from 'lucide-preact'
import { useState } from 'preact/hooks'
import { Ago } from './Ago.js'
import { Transparent } from './Buttons.js'
import { Ago } from '#components/Ago.js'
import { Transparent } from '#components/Buttons.js'
import './DeviceHeader.css'
import { EnergyEstimateIcons, EnergyEstimateLabel } from './SignalQuality.js'
import { LoadingIndicator } from './ValueLoading.js'
import { LTEm } from './icons/LTE-m.js'
import { NBIot } from './icons/NBIot.js'
import { SIMIcon } from './icons/SIMIcon.js'
import { IAQ } from './model/PCA20035-solar/BME680.js'
import { BatteryIndicator } from './model/PCA20035-solar/SolarThingyBattery.js'
import { Applied } from './Applied.js'
import {
EnergyEstimateIcons,
EnergyEstimateLabel,
} from '#components/SignalQuality.js'
import { LoadingIndicator } from '#components/ValueLoading.js'
import { LTEm } from '#components/icons/LTE-m.js'
import { NBIot } from '#components/icons/NBIot.js'
import { SIMIcon } from '#components/icons/SIMIcon.js'
import { IAQ } from '#components/model/PCA20035-solar/BME680.js'
import { BatteryIndicator } from '#components/model/PCA20035-solar/SolarThingyBattery.js'
import { Applied } from '#components/Applied.js'
import {
isConnectionInformation,
isDeviceInformation,
Expand Down
6 changes: 3 additions & 3 deletions src/components/DeviceModeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { type Device } from '#context/Device.js'
import cx from 'classnames'
import { Ban, HistoryIcon, Satellite, Settings2, X } from 'lucide-preact'
import { useEffect, useState } from 'preact/hooks'
import { Applied } from './Applied.js'
import { Secondary, Transparent } from './Buttons.js'
import { SIMIcon } from './icons/SIMIcon.js'
import { Applied } from '#components/Applied.js'
import { Secondary, Transparent } from '#components/Buttons.js'
import { SIMIcon } from '#components/icons/SIMIcon.js'

const LOW_POWER_INTERVAL = 3600
const INTERACTIVE_INTERVAL = 120
Expand Down
2 changes: 1 addition & 1 deletion src/components/Feedback.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FeedbackForm } from './FeedbackForm.js'
import { FeedbackForm } from '#components/FeedbackForm.js'

export const Feedback = () => (
<section class="pt-4 pb-4 bg-dark">
Expand Down
2 changes: 1 addition & 1 deletion src/components/FingerprintForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isFingerprint } from '@hello.nrfcloud.com/proto/fingerprint'
import { useState } from 'preact/hooks'
import { Secondary } from './buttons/Button.js'
import { Secondary } from '#components/buttons/Button.js'

export const FingerprintForm = () => {
const [productionRun, setProductionRun] = useState<string>('92b')
Expand Down
4 changes: 2 additions & 2 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NRFCloudLogo } from './icons/NRFCloudLogo.js'
import { Ago } from './Ago.js'
import { NRFCloudLogo } from '#components/icons/NRFCloudLogo.js'
import { Ago } from '#components/Ago.js'

const CopyrightYear = () => {
const startYear = 2023
Expand Down
12 changes: 6 additions & 6 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { debounce } from 'lodash-es'
import { Code2, Cpu, Fingerprint, MapPinned, TrashIcon } from 'lucide-preact'
import type { PropsWithChildren } from 'preact/compat'
import { useEffect, useState } from 'preact/hooks'
import { AppUpdateNotifier } from './AppUpdateNotifier.js'
import { BrandHeader } from './BrandHeader.js'
import { Transparent } from './Buttons.js'
import { NRFCloudLogo } from './icons/NRFCloudLogo.js'
import { Logo } from './icons/Logo.js'
import { PublicDeviceWarning } from './PublicDeviceWarning.js'
import { AppUpdateNotifier } from '#components/AppUpdateNotifier.js'
import { BrandHeader } from '#components/BrandHeader.js'
import { Transparent } from '#components/Buttons.js'
import { NRFCloudLogo } from '#components/icons/NRFCloudLogo.js'
import { Logo } from '#components/icons/Logo.js'
import { PublicDeviceWarning } from '#components/PublicDeviceWarning.js'

const Link = ({
href,
Expand Down
2 changes: 1 addition & 1 deletion src/components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isFingerprint } from '@hello.nrfcloud.com/proto/fingerprint'
import { Html5Qrcode, Html5QrcodeSupportedFormats } from 'html5-qrcode'
import { QrCode } from 'lucide-preact'
import { useEffect, useId, useState } from 'preact/hooks'
import { Primary } from './buttons/Button.js'
import { Primary } from '#components/buttons/Button.js'

type Camera = { id: string; label: string }

Expand Down
8 changes: 4 additions & 4 deletions src/components/ScanQR.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Model } from '#context/Models.js'
import { FingerprintForm } from './FingerprintForm.js'
import { QRCodeScanner } from './QRCodeScanner.js'
import { WithResize } from './ResizeObserver.js'
import { ThingyWithQRCode } from './ThingyWithQRCode.js'
import { FingerprintForm } from '#components/FingerprintForm.js'
import { QRCodeScanner } from '#components/QRCodeScanner.js'
import { WithResize } from '#components/ResizeObserver.js'
import { ThingyWithQRCode } from '#components/ThingyWithQRCode.js'

export const ScanQR = ({ type }: { type?: Model }) => (
<div class="bg-light">
Expand Down
4 changes: 2 additions & 2 deletions src/components/SignalQuality.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
SignalZero,
Slash,
} from 'lucide-preact'
import { LoadingIndicator } from './ValueLoading.js'
import type { LucideProps } from './icons/lucide.js'
import { LoadingIndicator } from '#components/ValueLoading.js'
import type { LucideProps } from '#components/icons/lucide.js'
import type { FunctionComponent } from 'preact'
import {
isConnectionInformation,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ThingyWithQRCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import code128 from 'code-128-encoder'
import { format } from 'date-fns'
import { useEffect, useRef, useState } from 'preact/hooks'
import QRCode from 'qrcode'
import type { Size } from './ResizeObserver.js'
import type { Size } from '#components/ResizeObserver.js'

const encoder = new code128()

Expand Down
6 changes: 3 additions & 3 deletions src/components/deviceInfo/NetworkInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { LoadingIndicator } from '#components/ValueLoading.js'
import { useDeviceState } from '#context/DeviceState.js'
import { identifyIssuer } from 'e118-iin-list'
import { CpuIcon } from 'lucide-preact'
import { SignalQuality } from '../SignalQuality.js'
import { SIMIcon } from '../icons/SIMIcon.js'
import { NetworkModeInfo } from './NetworkModeInfo.js'
import { SignalQuality } from '#components/SignalQuality.js'
import { SIMIcon } from '#components/icons/SIMIcon.js'
import { NetworkModeInfo } from '#components/deviceInfo/NetworkModeInfo.js'
import {
isConnectionInformation,
isDeviceInformation,
Expand Down
4 changes: 2 additions & 2 deletions src/components/deviceInfo/NetworkModeInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
isConnectionInformation,
toConnectionInformation,
} from '#proto/lwm2m.js'
import { LTEm } from '../icons/LTE-m.js'
import { NBIot } from '../icons/NBIot.js'
import { LTEm } from '#components/icons/LTE-m.js'
import { NBIot } from '#components/icons/NBIot.js'

export const NetworkModeInfo = () => {
const { state } = useDeviceState()
Expand Down
4 changes: 2 additions & 2 deletions src/components/deviceInfo/SoftwareInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { type Device } from '#context/Device.js'
import { useDeviceState } from '#context/DeviceState.js'
import { parseModemFirmwareVersion } from '#utils/parseModemFirmwareVersion.js'
import { AlertTriangle, CheckCircle2 } from 'lucide-preact'
import { ValueLoading } from '../ValueLoading.js'
import { isOutdated } from './isOutdated.js'
import { ValueLoading } from '#components/ValueLoading.js'
import { isOutdated } from '#components/deviceInfo/isOutdated.js'
import { isDeviceInformation, toDeviceInformation } from '#proto/lwm2m.js'

export const SoftwareInfo = ({ device }: { device: Device }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/mccmnc2country.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mcc2iso } from './mcc2iso.js'
import { mcc2iso } from '#components/mcc2iso.js'

/**
* returns the two-letter ISO 3661 country code for a given MCC/MNC combination
Expand Down
6 changes: 3 additions & 3 deletions src/components/model/PCA20035-solar/SolarThingyChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { BatteryCharging, Sun } from 'lucide-preact'
import {
isNotHistory,
useSolarThingyHistory,
} from '../../../context/models/PCA20035-solar.js'
import { toChartData } from '../../../chart/toChartData.js'
import { DateRangeButton } from '../../../chart/DateRangeButton.js'
} from '#context/models/PCA20035-solar.js'
import { toChartData } from '#chart/toChartData.js'
import { DateRangeButton } from '#chart/DateRangeButton.js'
import { WithResize } from '#components/ResizeObserver.js'
import { WaitingForData } from '#components/WaitingForData.js'
import { timeSpans } from '#chart/timeSpans.js'
Expand Down
6 changes: 3 additions & 3 deletions src/context/Device.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
useState,
} from 'preact/hooks'
import { validPassthrough } from '#proto/validPassthrough.js'
import { useFingerprint } from './Fingerprint.js'
import { useModels, type Model } from './Models.js'
import { useParameters } from './Parameters.js'
import { useFingerprint } from '#context/Fingerprint.js'
import { useModels, type Model } from '#context/Models.js'
import { useParameters } from '#context/Parameters.js'
import type { LwM2MObjectInstance } from '@hello.nrfcloud.com/proto-map/lwm2m'
import { isObject } from 'lodash-es'

Expand Down
2 changes: 1 addition & 1 deletion src/context/DeviceLocation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LocationSource } from '#map/LocationSourceLabels.js'
import { createContext, type ComponentChildren } from 'preact'
import { useContext, useEffect, useState } from 'preact/hooks'
import { useDevice, type MessageListenerFn } from './Device.js'
import { useDevice, type MessageListenerFn } from '#context/Device.js'
import { isGeolocation, toGeoLocation, type GeoLocation } from '#proto/lwm2m.js'
import { TimeSpan } from '#api/api.js'

Expand Down
2 changes: 1 addition & 1 deletion src/context/DeviceState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Context, Shadow } from '@hello.nrfcloud.com/proto/hello'
import { type Static } from '@sinclair/typebox'
import { createContext, type ComponentChildren } from 'preact'
import { useContext, useEffect, useState } from 'preact/hooks'
import { useDevice, type MessageListenerFn } from './Device.js'
import { useDevice, type MessageListenerFn } from '#context/Device.js'
import { isObject } from 'lodash-es'
import type { LwM2MObjectInstance } from '@hello.nrfcloud.com/proto-map/lwm2m'

Expand Down
2 changes: 1 addition & 1 deletion src/context/MapShare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useParameters } from '#context/Parameters.js'
import { validatingFetch } from '#utils/validatingFetch.js'
import { PublicDevice } from '@hello.nrfcloud.com/proto-map/api'
import type { Static } from '@sinclair/typebox'
import { useFingerprint } from './Fingerprint.js'
import { useFingerprint } from '#context/Fingerprint.js'

export const MapShareContext = createContext<{
shared?: Static<typeof PublicDevice>
Expand Down
6 changes: 3 additions & 3 deletions src/context/models/PCA20035-solar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TimeSpan } from 'api/api.js'
import { TimeSpan } from '#api/api.js'
import {
isBatteryAndPower,
isButtonPress,
Expand All @@ -15,8 +15,8 @@ import {
} from '#proto/lwm2m.js'
import { createContext, type ComponentChildren } from 'preact'
import { useContext, useEffect, useState } from 'preact/hooks'
import { useDevice, type MessageListenerFn } from '../Device.js'
import { byTs } from '../byTs.js'
import { useDevice, type MessageListenerFn } from '#context/Device.js'
import { byTs } from '#context/byTs.js'

type FromHistory = {
fromHistory?: boolean
Expand Down
5 changes: 4 additions & 1 deletion src/map/CellularLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { gnssEnabled } from '#context/DeviceState.js'
import { Located } from '#map/Map.js'
import { compareLocations } from '#map/compareLocations.js'
import type { GeoLocation } from '#proto/lwm2m.js'
import { LocationSource, LocationSourceLabels } from './LocationSourceLabels.js'
import {
LocationSource,
LocationSourceLabels,
} from '#map/LocationSourceLabels.js'

export const CellularLocation = () => {
const { locations } = useDeviceLocation()
Expand Down
2 changes: 1 addition & 1 deletion src/map/GNSSLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type Device } from '#context/Device.js'
import { useDeviceLocation } from '#context/DeviceLocation.js'
import { gnssEnabled } from '#context/DeviceState.js'
import { Located } from '#map/Map.js'
import { LocationSource } from './LocationSourceLabels.js'
import { LocationSource } from '#map/LocationSourceLabels.js'

export const GNSSLocation = ({ device }: { device: Device }) => {
const { locations } = useDeviceLocation()
Expand Down
2 changes: 1 addition & 1 deletion src/map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
LocationSource,
LocationSourceLabels,
locationSourceColors,
} from './LocationSourceLabels.js'
} from '#map/LocationSourceLabels.js'
import {
isConnectionInformation,
toConnectionInformation,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/localStorage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isSSR } from './isSSR.js'
import { isSSR } from '#utils/isSSR.js'

const fullKey = (key: string) => `hello:${key}`
export const getItem = <StoredType>(key: string): StoredType | null => {
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default defineConfig({
{ find: '#page/', replacement: '/src/page/' },
{ find: '#map/', replacement: '/src/map/' },
{ find: '#proto/', replacement: '/src/proto/' },
{ find: '#api/', replacement: '/src/api/' },
],
},
build: {
Expand Down

0 comments on commit 19560d4

Please sign in to comment.