better structure

This commit is contained in:
Ren Amamiya
2023-05-10 16:17:38 +07:00
parent 1a30c10806
commit e7bcf6c3f8
94 changed files with 533 additions and 403 deletions

View File

@@ -1,5 +1,6 @@
import MutedItem from '@lume/app/channel/components/mutedItem';
import MuteIcon from '@lume/shared/icons/mute';
import MutedItem from '@app/channel/components/mutedItem';
import MuteIcon from '@icons/mute';
import { Popover, Transition } from '@headlessui/react';
import { Fragment } from 'react';

View File

@@ -1,12 +1,15 @@
import { AvatarUploader } from '@lume/shared/avatarUploader';
import CancelIcon from '@lume/shared/icons/cancel';
import PlusIcon from '@lume/shared/icons/plus';
import { Image } from '@lume/shared/image';
import { RelayContext } from '@lume/shared/relayProvider';
import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';
import { useActiveAccount } from '@lume/utils/hooks/useActiveAccount';
import { createChannel } from '@lume/utils/storage';
import { AvatarUploader } from '@shared/avatarUploader';
import { Image } from '@shared/image';
import { RelayContext } from '@shared/relayProvider';
import CancelIcon from '@icons/cancel';
import PlusIcon from '@icons/plus';
import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { createChannel } from '@utils/storage';
import { Dialog, Transition } from '@headlessui/react';
import { getEventHash, signEvent } from 'nostr-tools';

View File

@@ -1,5 +1,6 @@
import { useChannelProfile } from '@lume/utils/hooks/useChannelProfile';
import { usePageContext } from '@lume/utils/hooks/usePageContext';
import { useChannelProfile } from '@app/channel/hooks/useChannelProfile';
import { usePageContext } from '@utils/hooks/usePageContext';
import { twMerge } from 'tailwind-merge';

View File

@@ -1,6 +1,7 @@
import ChannelCreateModal from '@lume/app/channel/components/createModal';
import ChannelsListItem from '@lume/app/channel/components/item';
import { getChannels } from '@lume/utils/storage';
import ChannelCreateModal from '@app/channel/components/createModal';
import ChannelsListItem from '@app/channel/components/item';
import { getChannels } from '@utils/storage';
import useSWR from 'swr';

View File

@@ -1,5 +1,6 @@
import MiniMember from '@lume/app/channel/components/miniMember';
import { channelMembersAtom } from '@lume/stores/channel';
import MiniMember from '@app/channel/components/miniMember';
import { channelMembersAtom } from '@stores/channel';
import { useAtomValue } from 'jotai';

View File

@@ -1,6 +1,8 @@
import ChannelMessageItem from '@lume/app/channel/components/messages/item';
import { sortedChannelMessagesAtom } from '@lume/stores/channel';
import { hoursAgo } from '@lume/utils/getDate';
import ChannelMessageItem from '@app/channel/components/messages/item';
import { sortedChannelMessagesAtom } from '@stores/channel';
import { getHourAgo } from '@utils/date';
import { useAtomValue } from 'jotai';
import { useCallback, useRef } from 'react';
@@ -39,7 +41,7 @@ export default function ChannelMessageList() {
</div>
<div className="relative flex justify-center">
<div className="inline-flex items-center gap-x-1.5 rounded-full bg-zinc-900 px-3 py-1.5 text-xs font-medium text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-800">
{hoursAgo(24, now.current).toLocaleDateString('en-US', {
{getHourAgo(24, now.current).toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',

View File

@@ -1,11 +1,15 @@
import UserReply from '@lume/app/channel/components/messages/userReply';
import { ImagePicker } from '@lume/shared/form/imagePicker';
import CancelIcon from '@lume/shared/icons/cancel';
import { RelayContext } from '@lume/shared/relayProvider';
import { channelContentAtom, channelReplyAtom } from '@lume/stores/channel';
import { WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';
import { useActiveAccount } from '@lume/utils/hooks/useActiveAccount';
import UserReply from '@app/channel/components/messages/userReply';
import { ImagePicker } from '@shared/form/imagePicker';
import { RelayContext } from '@shared/relayProvider';
import CancelIcon from '@icons/cancel';
import { channelContentAtom, channelReplyAtom } from '@stores/channel';
import { WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { useAtom, useAtomValue } from 'jotai';
import { useResetAtom } from 'jotai/utils';

View File

@@ -1,11 +1,14 @@
import CancelIcon from '@lume/shared/icons/cancel';
import HideIcon from '@lume/shared/icons/hide';
import { RelayContext } from '@lume/shared/relayProvider';
import { Tooltip } from '@lume/shared/tooltip';
import { channelMessagesAtom } from '@lume/stores/channel';
import { WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';
import { useActiveAccount } from '@lume/utils/hooks/useActiveAccount';
import { RelayContext } from '@shared/relayProvider';
import { Tooltip } from '@shared/tooltip';
import CancelIcon from '@icons/cancel';
import HideIcon from '@icons/hide';
import { channelMessagesAtom } from '@stores/channel';
import { WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { Dialog, Transition } from '@headlessui/react';
import { useAtom } from 'jotai';

View File

@@ -1,8 +1,9 @@
import MessageHideButton from '@lume/app/channel/components/messages/hideButton';
import MessageMuteButton from '@lume/app/channel/components/messages/muteButton';
import MessageReplyButton from '@lume/app/channel/components/messages/replyButton';
import ChannelMessageUser from '@lume/app/channel/components/messages/user';
import { noteParser } from '@lume/utils/parser';
import MessageHideButton from '@app/channel/components/messages/hideButton';
import MessageMuteButton from '@app/channel/components/messages/muteButton';
import MessageReplyButton from '@app/channel/components/messages/replyButton';
import ChannelMessageUser from '@app/channel/components/messages/user';
import { noteParser } from '@utils/parser';
import { useMemo } from 'react';

View File

@@ -1,11 +1,14 @@
import CancelIcon from '@lume/shared/icons/cancel';
import MuteIcon from '@lume/shared/icons/mute';
import { RelayContext } from '@lume/shared/relayProvider';
import { Tooltip } from '@lume/shared/tooltip';
import { channelMessagesAtom } from '@lume/stores/channel';
import { WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';
import { useActiveAccount } from '@lume/utils/hooks/useActiveAccount';
import { RelayContext } from '@shared/relayProvider';
import { Tooltip } from '@shared/tooltip';
import CancelIcon from '@icons/cancel';
import MuteIcon from '@icons/mute';
import { channelMessagesAtom } from '@stores/channel';
import { WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { Dialog, Transition } from '@headlessui/react';
import { useAtom } from 'jotai';

View File

@@ -1,6 +1,8 @@
import ReplyMessageIcon from '@lume/shared/icons/replyMessage';
import { Tooltip } from '@lume/shared/tooltip';
import { channelReplyAtom } from '@lume/stores/channel';
import { Tooltip } from '@shared/tooltip';
import ReplyMessageIcon from '@icons/replyMessage';
import { channelReplyAtom } from '@stores/channel';
import { useSetAtom } from 'jotai';

View File

@@ -1,7 +1,9 @@
import { Image } from '@lume/shared/image';
import { DEFAULT_AVATAR, IMGPROXY_URL } from '@lume/stores/constants';
import { useProfile } from '@lume/utils/hooks/useProfile';
import { shortenKey } from '@lume/utils/shortenKey';
import { Image } from '@shared/image';
import { DEFAULT_AVATAR, IMGPROXY_URL } from '@stores/constants';
import { useProfile } from '@utils/hooks/useProfile';
import { shortenKey } from '@utils/shortenKey';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';

View File

@@ -1,7 +1,9 @@
import { Image } from '@lume/shared/image';
import { DEFAULT_AVATAR, IMGPROXY_URL } from '@lume/stores/constants';
import { useProfile } from '@lume/utils/hooks/useProfile';
import { shortenKey } from '@lume/utils/shortenKey';
import { Image } from '@shared/image';
import { DEFAULT_AVATAR, IMGPROXY_URL } from '@stores/constants';
import { useProfile } from '@utils/hooks/useProfile';
import { shortenKey } from '@utils/shortenKey';
export default function UserReply({ pubkey }: { pubkey: string }) {
const { user, isError, isLoading } = useProfile(pubkey);

View File

@@ -1,7 +1,10 @@
import CopyIcon from '@lume/shared/icons/copy';
import { Image } from '@lume/shared/image';
import { DEFAULT_AVATAR } from '@lume/stores/constants';
import { useChannelProfile } from '@lume/utils/hooks/useChannelProfile';
import { useChannelProfile } from '@app/channel/hooks/useChannelProfile';
import { Image } from '@shared/image';
import CopyIcon from '@icons/copy';
import { DEFAULT_AVATAR } from '@stores/constants';
import { nip19 } from 'nostr-tools';

View File

@@ -1,6 +1,8 @@
import { Image } from '@lume/shared/image';
import { DEFAULT_AVATAR } from '@lume/stores/constants';
import { useProfile } from '@lume/utils/hooks/useProfile';
import { Image } from '@shared/image';
import { DEFAULT_AVATAR } from '@stores/constants';
import { useProfile } from '@utils/hooks/useProfile';
export default function MiniMember({ pubkey }: { pubkey: string }) {
const { user, isError, isLoading } = useProfile(pubkey);

View File

@@ -1,7 +1,9 @@
import { Image } from '@lume/shared/image';
import { DEFAULT_AVATAR } from '@lume/stores/constants';
import { useProfile } from '@lume/utils/hooks/useProfile';
import { shortenKey } from '@lume/utils/shortenKey';
import { Image } from '@shared/image';
import { DEFAULT_AVATAR } from '@stores/constants';
import { useProfile } from '@utils/hooks/useProfile';
import { shortenKey } from '@utils/shortenKey';
import { useState } from 'react';
@@ -10,7 +12,7 @@ export default function MutedItem({ data }: { data: any }) {
const [status, setStatus] = useState(data.status);
const unmute = async () => {
const { updateItemInBlacklist } = await import('@lume/utils/storage');
const { updateItemInBlacklist } = await import('@utils/storage');
const res = await updateItemInBlacklist(data.content, 0);
if (res) {
setStatus(0);
@@ -18,7 +20,7 @@ export default function MutedItem({ data }: { data: any }) {
};
const mute = async () => {
const { updateItemInBlacklist } = await import('@lume/utils/storage');
const { updateItemInBlacklist } = await import('@utils/storage');
const res = await updateItemInBlacklist(data.content, 1);
if (res) {
setStatus(1);

View File

@@ -1,12 +1,15 @@
import { AvatarUploader } from '@lume/shared/avatarUploader';
import CancelIcon from '@lume/shared/icons/cancel';
import EditIcon from '@lume/shared/icons/edit';
import { Image } from '@lume/shared/image';
import { RelayContext } from '@lume/shared/relayProvider';
import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';
import { useActiveAccount } from '@lume/utils/hooks/useActiveAccount';
import { getChannel, updateChannelMetadata } from '@lume/utils/storage';
import { AvatarUploader } from '@shared/avatarUploader';
import { Image } from '@shared/image';
import { RelayContext } from '@shared/relayProvider';
import CancelIcon from '@icons/cancel';
import EditIcon from '@icons/edit';
import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/date';
import { useActiveAccount } from '@utils/hooks/useActiveAccount';
import { getChannel, updateChannelMetadata } from '@utils/storage';
import { Dialog, Transition } from '@headlessui/react';
import { getEventHash, signEvent } from 'nostr-tools';