convert const function to function

This commit is contained in:
Ren Amamiya
2023-05-10 15:48:24 +07:00
parent ae5ff0c48f
commit 1a30c10806
32 changed files with 87 additions and 79 deletions

View File

@@ -4,7 +4,7 @@ import { open } from '@tauri-apps/api/dialog';
import { Body, fetch } from '@tauri-apps/api/http';
import { useState } from 'react';
export const AvatarUploader = ({ valueState }: { valueState: any }) => {
export function AvatarUploader({ valueState }: { valueState: any }) {
const [loading, setLoading] = useState(false);
const openFileDialog = async () => {
@@ -72,4 +72,4 @@ export const AvatarUploader = ({ valueState }: { valueState: any }) => {
)}
</button>
);
};
}

View File

@@ -9,7 +9,7 @@ import { Body, fetch } from '@tauri-apps/api/http';
import { useSetAtom } from 'jotai';
import { useState } from 'react';
export const ImagePicker = ({ type }: { type: string }) => {
export function ImagePicker({ type }: { type: string }) {
let atom;
switch (type) {
@@ -93,4 +93,4 @@ export const ImagePicker = ({ type }: { type: string }) => {
)}
</button>
);
};
}

View File

@@ -1,6 +1,6 @@
import { DEFAULT_AVATAR } from '@lume/stores/constants';
export const Image = (props) => {
export function Image(props) {
const addImageFallback = (event) => {
event.currentTarget.src = DEFAULT_AVATAR;
};
@@ -8,4 +8,4 @@ export const Image = (props) => {
return (
<img {...props} loading="lazy" decoding="async" onError={addImageFallback} style={{ contentVisibility: 'auto' }} />
);
};
}

View File

@@ -1,6 +1,6 @@
import { useNetworkStatus } from '@lume/utils/hooks/useNetworkStatus';
export const NetworkStatusIndicator = () => {
export function NetworkStatusIndicator() {
const isOnline = useNetworkStatus();
return (
@@ -18,4 +18,4 @@ export const NetworkStatusIndicator = () => {
<p className="text-xs font-medium text-zinc-500">{isOnline ? 'Online' : 'Offline'}</p>
</div>
);
};
}

View File

@@ -12,6 +12,6 @@ const pool = new RelayPool(FULL_RELAYS, {
logSubscriptions: false,
});
export default function RelayProvider({ children }: { children: React.ReactNode }) {
export function RelayProvider({ children }: { children: React.ReactNode }) {
return <RelayContext.Provider value={pool}>{children}</RelayContext.Provider>;
}

View File

@@ -1,7 +1,7 @@
import { autoUpdate, offset, shift, useFloating, useFocus, useHover, useInteractions } from '@floating-ui/react';
import { useState } from 'react';
export default function Tooltip({ children, message }: { children: React.ReactNode; message: string }) {
export function Tooltip({ children, message }: { children: React.ReactNode; message: string }) {
const [isOpen, setIsOpen] = useState(false);
const { x, y, strategy, refs, context } = useFloating({