mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-07 07:13:11 +00:00
fix: linting errors + stricter rules
This commit is contained in:
parent
4e29990e12
commit
d43d3bfec7
@ -23,7 +23,10 @@ export default tseslint.config(
|
|||||||
"warn",
|
"warn",
|
||||||
{ allowConstantExport: true },
|
{ allowConstantExport: true },
|
||||||
],
|
],
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": ["error", {
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"varsIgnorePattern": "^_"
|
||||||
|
}],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ interface CommentFeedItem extends FeedItemBase {
|
|||||||
type FeedItem = PostFeedItem | CommentFeedItem;
|
type FeedItem = PostFeedItem | CommentFeedItem;
|
||||||
|
|
||||||
const ActivityFeed: React.FC = () => {
|
const ActivityFeed: React.FC = () => {
|
||||||
const { posts, comments, cells, getCellById, isInitialLoading, userVerificationStatus } = useForum();
|
const { posts, comments, getCellById, isInitialLoading, userVerificationStatus } = useForum();
|
||||||
|
|
||||||
const combinedFeed: FeedItem[] = [
|
const combinedFeed: FeedItem[] = [
|
||||||
...posts.map((post): PostFeedItem => ({
|
...posts.map((post): PostFeedItem => ({
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { useAuth } from '@/contexts/useAuth';
|
|||||||
import { useForum } from '@/contexts/useForum';
|
import { useForum } from '@/contexts/useForum';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { LogOut, Terminal, Wifi, WifiOff, AlertTriangle, CheckCircle, Key, RefreshCw, CircleSlash, Home, Grid3X3, Plus } from 'lucide-react';
|
import { LogOut, Terminal, Wifi, WifiOff, AlertTriangle, CheckCircle, Key, RefreshCw, CircleSlash, Home, Grid3X3} from 'lucide-react';
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||||
import { useToast } from '@/components/ui/use-toast';
|
import { useToast } from '@/components/ui/use-toast';
|
||||||
import { useAppKitAccount, useDisconnect } from '@reown/appkit/react';
|
import { useAppKitAccount, useDisconnect } from '@reown/appkit/react';
|
||||||
@ -13,12 +13,8 @@ import { WalletWizard } from '@/components/ui/wallet-wizard';
|
|||||||
const Header = () => {
|
const Header = () => {
|
||||||
const {
|
const {
|
||||||
currentUser,
|
currentUser,
|
||||||
isAuthenticated,
|
|
||||||
verificationStatus,
|
verificationStatus,
|
||||||
verifyOwnership,
|
|
||||||
delegateKey,
|
|
||||||
isDelegationValid,
|
isDelegationValid,
|
||||||
delegationTimeRemaining
|
|
||||||
} = useAuth();
|
} = useAuth();
|
||||||
const { isNetworkConnected, isRefreshing } = useForum();
|
const { isNetworkConnected, isRefreshing } = useForum();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|||||||
@ -4,11 +4,10 @@ import { useForum } from '@/contexts/useForum';
|
|||||||
import { useAuth } from '@/contexts/useAuth';
|
import { useAuth } from '@/contexts/useAuth';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { ArrowLeft, ArrowUp, ArrowDown, Clock, MessageCircle, Send, RefreshCw, Eye, Loader2 } from 'lucide-react';
|
import { ArrowLeft, ArrowUp, ArrowDown, Clock, MessageCircle, Send, Eye, Loader2 } from 'lucide-react';
|
||||||
import { formatDistanceToNow } from 'date-fns';
|
import { formatDistanceToNow } from 'date-fns';
|
||||||
import { Comment } from '@/types';
|
import { Comment } from '@/types/forum';
|
||||||
import { CypherImage } from './ui/CypherImage';
|
import { CypherImage } from './ui/CypherImage';
|
||||||
import { Badge } from '@/components/ui/badge';
|
|
||||||
import { RelevanceIndicator } from './ui/relevance-indicator';
|
import { RelevanceIndicator } from './ui/relevance-indicator';
|
||||||
import { AuthorDisplay } from './ui/author-display';
|
import { AuthorDisplay } from './ui/author-display';
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ const PostDetail = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const {
|
const {
|
||||||
posts,
|
posts,
|
||||||
comments,
|
|
||||||
getCommentsByPost,
|
getCommentsByPost,
|
||||||
createComment,
|
createComment,
|
||||||
votePost,
|
votePost,
|
||||||
@ -26,13 +24,11 @@ const PostDetail = () => {
|
|||||||
isInitialLoading,
|
isInitialLoading,
|
||||||
isPostingComment,
|
isPostingComment,
|
||||||
isVoting,
|
isVoting,
|
||||||
isRefreshing,
|
|
||||||
refreshData,
|
|
||||||
moderateComment,
|
moderateComment,
|
||||||
moderateUser,
|
moderateUser,
|
||||||
userVerificationStatus
|
userVerificationStatus
|
||||||
} = useForum();
|
} = useForum();
|
||||||
const { currentUser, isAuthenticated, verificationStatus } = useAuth();
|
const { currentUser, verificationStatus } = useAuth();
|
||||||
const [newComment, setNewComment] = useState('');
|
const [newComment, setNewComment] = useState('');
|
||||||
|
|
||||||
if (!postId) return <div>Invalid post ID</div>;
|
if (!postId) return <div>Invalid post ID</div>;
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { ArrowLeft, MessageSquare, MessageCircle, ArrowUp, ArrowDown, Clock, RefreshCw, Eye } from 'lucide-react';
|
import { ArrowLeft, MessageSquare, MessageCircle, ArrowUp, ArrowDown, RefreshCw, Eye } from 'lucide-react';
|
||||||
import { formatDistanceToNow } from 'date-fns';
|
import { formatDistanceToNow } from 'date-fns';
|
||||||
import { CypherImage } from './ui/CypherImage';
|
import { CypherImage } from './ui/CypherImage';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
@ -17,7 +17,6 @@ const PostList = () => {
|
|||||||
const {
|
const {
|
||||||
getCellById,
|
getCellById,
|
||||||
getPostsByCell,
|
getPostsByCell,
|
||||||
getCommentsByPost,
|
|
||||||
createPost,
|
createPost,
|
||||||
isInitialLoading,
|
isInitialLoading,
|
||||||
isPostingPost,
|
isPostingPost,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { Button } from './button';
|
import { Button } from './button';
|
||||||
import { useAuth } from '@/contexts/useAuth';
|
import { useAuth } from '@/contexts/useAuth';
|
||||||
import { CheckCircle, AlertCircle, Trash2 } from 'lucide-react';
|
import { CheckCircle, AlertCircle, Trash2 } from 'lucide-react';
|
||||||
import { DelegationDuration } from '@/lib/identity/services/CryptoService';
|
import { DelegationDuration } from '@/lib/services/CryptoService';
|
||||||
|
|
||||||
interface DelegationStepProps {
|
interface DelegationStepProps {
|
||||||
onComplete: () => void;
|
onComplete: () => void;
|
||||||
@ -61,7 +61,7 @@ export function DelegationStep({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
setDelegationResult({
|
setDelegationResult({
|
||||||
success: false,
|
success: false,
|
||||||
message: "Delegation failed. Please try again."
|
message: `Delegation failed. Please try again: ${error}`
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@ -72,10 +72,6 @@ export function DelegationStep({
|
|||||||
onComplete();
|
onComplete();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRefresh = () => {
|
|
||||||
window.location.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Show delegation result
|
// Show delegation result
|
||||||
if (delegationResult) {
|
if (delegationResult) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { Bitcoin, Coins, Shield, ShieldCheck, Loader2, AlertCircle } from "lucide-react";
|
import { Bitcoin, Coins, Shield, ShieldCheck, Loader2, AlertCircle } from "lucide-react";
|
||||||
import { useAuth } from "@/contexts/useAuth";
|
import { useAuth } from "@/contexts/useAuth";
|
||||||
import { useAppKitAccount } from "@reown/appkit/react";
|
import { useAppKitAccount } from "@reown/appkit/react";
|
||||||
@ -31,7 +30,7 @@ export function VerificationStep({
|
|||||||
|
|
||||||
const isBitcoinConnected = bitcoinAccount.isConnected;
|
const isBitcoinConnected = bitcoinAccount.isConnected;
|
||||||
const isEthereumConnected = ethereumAccount.isConnected;
|
const isEthereumConnected = ethereumAccount.isConnected;
|
||||||
const walletType = isBitcoinConnected ? 'bitcoin' : 'ethereum';
|
const walletType = isBitcoinConnected ? 'bitcoin' : isEthereumConnected ? 'ethereum' : undefined;
|
||||||
|
|
||||||
const [verificationResult, setVerificationResult] = React.useState<{
|
const [verificationResult, setVerificationResult] = React.useState<{
|
||||||
success: boolean;
|
success: boolean;
|
||||||
@ -69,7 +68,7 @@ export function VerificationStep({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
setVerificationResult({
|
setVerificationResult({
|
||||||
success: false,
|
success: false,
|
||||||
message: "Verification failed. Please try again."
|
message: `Verification failed. Please try again: ${error}`
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from "react";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Bitcoin, Coins, Loader2 } from "lucide-react";
|
import { Bitcoin, Coins, Loader2 } from "lucide-react";
|
||||||
@ -7,7 +6,6 @@ import {
|
|||||||
useAppKitAccount,
|
useAppKitAccount,
|
||||||
useAppKitState
|
useAppKitState
|
||||||
} from "@reown/appkit/react";
|
} from "@reown/appkit/react";
|
||||||
import { useAuth } from "@/contexts/useAuth";
|
|
||||||
|
|
||||||
interface WalletConnectionStepProps {
|
interface WalletConnectionStepProps {
|
||||||
onComplete: () => void;
|
onComplete: () => void;
|
||||||
@ -22,7 +20,6 @@ export function WalletConnectionStep({
|
|||||||
}: WalletConnectionStepProps) {
|
}: WalletConnectionStepProps) {
|
||||||
const { initialized } = useAppKitState();
|
const { initialized } = useAppKitState();
|
||||||
const appKit = useAppKit();
|
const appKit = useAppKit();
|
||||||
const { isAuthenticated } = useAuth();
|
|
||||||
|
|
||||||
// Get account info for different chains
|
// Get account info for different chains
|
||||||
const bitcoinAccount = useAppKitAccount({ namespace: "bip122" });
|
const bitcoinAccount = useAppKitAccount({ namespace: "bip122" });
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export function WalletWizard({
|
|||||||
}: WalletWizardProps) {
|
}: WalletWizardProps) {
|
||||||
const [currentStep, setCurrentStep] = React.useState<WizardStep>(1);
|
const [currentStep, setCurrentStep] = React.useState<WizardStep>(1);
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
const { currentUser, isAuthenticated, verificationStatus, isDelegationValid } = useAuth();
|
const { isAuthenticated, verificationStatus, isDelegationValid } = useAuth();
|
||||||
const hasInitialized = React.useRef(false);
|
const hasInitialized = React.useRef(false);
|
||||||
|
|
||||||
// Reset wizard when opened and determine starting step
|
// Reset wizard when opened and determine starting step
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import React, { createContext, useContext, useState, useEffect, useRef } from 'react';
|
import React, { createContext, useState, useEffect, useRef } from 'react';
|
||||||
import { useToast } from '@/components/ui/use-toast';
|
import { useToast } from '@/components/ui/use-toast';
|
||||||
import { User, OpchanMessage, EVerificationStatus } from '@/types/forum';
|
import { User, OpchanMessage, EVerificationStatus } from '@/types/forum';
|
||||||
import { AuthService, CryptoService, MessageService, DelegationDuration } from '@/lib/identity/services';
|
import { AuthService, CryptoService, DelegationDuration } from '@/lib/services';
|
||||||
import { AuthResult } from '@/lib/identity/services/AuthService';
|
import { AuthResult } from '@/lib/services/AuthService';
|
||||||
import { useAppKitAccount, useDisconnect, modal } from '@reown/appkit/react';
|
import { useAppKitAccount, useDisconnect, modal } from '@reown/appkit/react';
|
||||||
|
|
||||||
export type VerificationStatus = 'unverified' | 'verified-none' | 'verified-basic' | 'verified-owner' | 'verifying';
|
export type VerificationStatus = 'unverified' | 'verified-none' | 'verified-basic' | 'verified-owner' | 'verifying';
|
||||||
@ -49,7 +49,6 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
|||||||
// Create service instances that persist between renders
|
// Create service instances that persist between renders
|
||||||
const cryptoServiceRef = useRef(new CryptoService());
|
const cryptoServiceRef = useRef(new CryptoService());
|
||||||
const authServiceRef = useRef(new AuthService(cryptoServiceRef.current));
|
const authServiceRef = useRef(new AuthService(cryptoServiceRef.current));
|
||||||
const messageServiceRef = useRef(new MessageService(authServiceRef.current, cryptoServiceRef.current));
|
|
||||||
|
|
||||||
// Set AppKit instance and accounts in AuthService
|
// Set AppKit instance and accounts in AuthService
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -324,10 +323,6 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const isWalletAvailable = (): boolean => {
|
|
||||||
return isConnected;
|
|
||||||
};
|
|
||||||
|
|
||||||
const messageSigning = {
|
const messageSigning = {
|
||||||
signMessage: async (message: OpchanMessage): Promise<OpchanMessage | null> => {
|
signMessage: async (message: OpchanMessage): Promise<OpchanMessage | null> => {
|
||||||
return cryptoServiceRef.current.signMessage(message);
|
return cryptoServiceRef.current.signMessage(message);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { createContext, useContext, useState, useEffect, useCallback, useMemo } from 'react';
|
import React, { createContext, useState, useEffect, useCallback, useMemo } from 'react';
|
||||||
import { Cell, Post, Comment, OpchanMessage, User, EVerificationStatus } from '@/types/forum';
|
import { Cell, Post, Comment, OpchanMessage, User, EVerificationStatus } from '@/types/forum';
|
||||||
import { useToast } from '@/components/ui/use-toast';
|
import { useToast } from '@/components/ui/use-toast';
|
||||||
import { useAuth } from '@/contexts/useAuth';
|
import { useAuth } from '@/contexts/useAuth';
|
||||||
@ -20,7 +20,7 @@ import messageManager from '@/lib/waku';
|
|||||||
import { getDataFromCache } from '@/lib/forum/transformers';
|
import { getDataFromCache } from '@/lib/forum/transformers';
|
||||||
import { RelevanceCalculator } from '@/lib/forum/relevance';
|
import { RelevanceCalculator } from '@/lib/forum/relevance';
|
||||||
import { UserVerificationStatus } from '@/types/forum';
|
import { UserVerificationStatus } from '@/types/forum';
|
||||||
import { CryptoService, AuthService } from '@/lib/identity/services';
|
import { CryptoService, AuthService } from '@/lib/services';
|
||||||
import { getEnsName } from '@wagmi/core';
|
import { getEnsName } from '@wagmi/core';
|
||||||
import { config } from '@/lib/identity/wallets/appkit';
|
import { config } from '@/lib/identity/wallets/appkit';
|
||||||
|
|
||||||
|
|||||||
@ -15,12 +15,12 @@ type ToasterToast = ToastProps & {
|
|||||||
action?: ToastActionElement
|
action?: ToastActionElement
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionTypes = {
|
enum ActionTypes {
|
||||||
ADD_TOAST: "ADD_TOAST",
|
ADD_TOAST = "ADD_TOAST",
|
||||||
UPDATE_TOAST: "UPDATE_TOAST",
|
UPDATE_TOAST = "UPDATE_TOAST",
|
||||||
DISMISS_TOAST: "DISMISS_TOAST",
|
DISMISS_TOAST = "DISMISS_TOAST",
|
||||||
REMOVE_TOAST: "REMOVE_TOAST",
|
REMOVE_TOAST = "REMOVE_TOAST",
|
||||||
} as const
|
}
|
||||||
|
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
@ -29,23 +29,22 @@ function genId() {
|
|||||||
return count.toString()
|
return count.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActionType = typeof actionTypes
|
|
||||||
|
|
||||||
type Action =
|
type Action =
|
||||||
| {
|
| {
|
||||||
type: ActionType["ADD_TOAST"]
|
type: ActionTypes.ADD_TOAST
|
||||||
toast: ToasterToast
|
toast: ToasterToast
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: ActionType["UPDATE_TOAST"]
|
type: ActionTypes.UPDATE_TOAST
|
||||||
toast: Partial<ToasterToast>
|
toast: Partial<ToasterToast>
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: ActionType["DISMISS_TOAST"]
|
type: ActionTypes.DISMISS_TOAST
|
||||||
toastId?: ToasterToast["id"]
|
toastId?: ToasterToast["id"]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: ActionType["REMOVE_TOAST"]
|
type: ActionTypes.REMOVE_TOAST
|
||||||
toastId?: ToasterToast["id"]
|
toastId?: ToasterToast["id"]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ const addToRemoveQueue = (toastId: string) => {
|
|||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
toastTimeouts.delete(toastId)
|
toastTimeouts.delete(toastId)
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "REMOVE_TOAST",
|
type: ActionTypes.REMOVE_TOAST,
|
||||||
toastId: toastId,
|
toastId: toastId,
|
||||||
})
|
})
|
||||||
}, TOAST_REMOVE_DELAY)
|
}, TOAST_REMOVE_DELAY)
|
||||||
@ -73,13 +72,13 @@ const addToRemoveQueue = (toastId: string) => {
|
|||||||
|
|
||||||
export const reducer = (state: State, action: Action): State => {
|
export const reducer = (state: State, action: Action): State => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "ADD_TOAST":
|
case ActionTypes.ADD_TOAST:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
||||||
}
|
}
|
||||||
|
|
||||||
case "UPDATE_TOAST":
|
case ActionTypes.UPDATE_TOAST:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
toasts: state.toasts.map((t) =>
|
toasts: state.toasts.map((t) =>
|
||||||
@ -87,7 +86,7 @@ export const reducer = (state: State, action: Action): State => {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
case "DISMISS_TOAST": {
|
case ActionTypes.DISMISS_TOAST: {
|
||||||
const { toastId } = action
|
const { toastId } = action
|
||||||
|
|
||||||
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
||||||
@ -112,7 +111,7 @@ export const reducer = (state: State, action: Action): State => {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "REMOVE_TOAST":
|
case ActionTypes.REMOVE_TOAST:
|
||||||
if (action.toastId === undefined) {
|
if (action.toastId === undefined) {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
@ -144,13 +143,13 @@ function toast({ ...props }: Toast) {
|
|||||||
|
|
||||||
const update = (props: ToasterToast) =>
|
const update = (props: ToasterToast) =>
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "UPDATE_TOAST",
|
type: ActionTypes.UPDATE_TOAST,
|
||||||
toast: { ...props, id },
|
toast: { ...props, id },
|
||||||
})
|
})
|
||||||
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
|
const dismiss = () => dispatch({ type: ActionTypes.DISMISS_TOAST, toastId: id })
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "ADD_TOAST",
|
type: ActionTypes.ADD_TOAST,
|
||||||
toast: {
|
toast: {
|
||||||
...props,
|
...props,
|
||||||
id,
|
id,
|
||||||
@ -184,7 +183,7 @@ function useToast() {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
toast,
|
toast,
|
||||||
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
dismiss: (toastId?: string) => dispatch({ type: ActionTypes.DISMISS_TOAST, toastId }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -146,7 +146,6 @@ describe('RelevanceCalculator', () => {
|
|||||||
describe('timeDecay', () => {
|
describe('timeDecay', () => {
|
||||||
it('should apply time decay to older posts', () => {
|
it('should apply time decay to older posts', () => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const oneDayAgo = now - (24 * 60 * 60 * 1000);
|
|
||||||
const oneWeekAgo = now - (7 * 24 * 60 * 60 * 1000);
|
const oneWeekAgo = now - (7 * 24 * 60 * 60 * 1000);
|
||||||
|
|
||||||
const recentPost: Post = {
|
const recentPost: Post = {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
} from '@/lib/waku/types';
|
} from '@/lib/waku/types';
|
||||||
import { Cell, Comment, Post, User } from '@/types/forum';
|
import { Cell, Comment, Post, User } from '@/types/forum';
|
||||||
import { transformCell, transformComment, transformPost } from './transformers';
|
import { transformCell, transformComment, transformPost } from './transformers';
|
||||||
import { MessageService, AuthService, CryptoService } from '@/lib/identity/services';
|
import { MessageService, AuthService, CryptoService } from '@/lib/services';
|
||||||
|
|
||||||
type ToastFunction = (props: {
|
type ToastFunction = (props: {
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@ -151,7 +151,6 @@ export class RelevanceCalculator {
|
|||||||
calculateCellScore(
|
calculateCellScore(
|
||||||
cell: Cell,
|
cell: Cell,
|
||||||
posts: Post[],
|
posts: Post[],
|
||||||
userVerificationStatus: UserVerificationStatus
|
|
||||||
): { score: number; details: RelevanceScoreDetails } {
|
): { score: number; details: RelevanceScoreDetails } {
|
||||||
// Apply base score
|
// Apply base score
|
||||||
let score = this.applyBaseScore('CELL');
|
let score = this.applyBaseScore('CELL');
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import { Cell, Post, Comment, OpchanMessage, User } from '@/types';
|
import { Cell, Post, Comment, OpchanMessage } from '@/types/forum';
|
||||||
import { CellMessage, CommentMessage, MessageType, PostMessage, VoteMessage } from '@/lib/waku/types';
|
import { CellMessage, CommentMessage, PostMessage, VoteMessage } from '@/lib/waku/types';
|
||||||
import messageManager from '@/lib/waku';
|
import messageManager from '@/lib/waku';
|
||||||
import { RelevanceCalculator, UserVerificationStatus } from './relevance';
|
import { RelevanceCalculator } from './relevance';
|
||||||
|
import { UserVerificationStatus } from '@/types/forum';
|
||||||
|
|
||||||
type VerifyFunction = (message: OpchanMessage) => boolean;
|
type VerifyFunction = (message: OpchanMessage) => boolean;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { UseAppKitAccountReturn } from '@reown/appkit/react';
|
import { UseAppKitAccountReturn } from '@reown/appkit/react';
|
||||||
import { CryptoService, DelegationDuration } from '../services/CryptoService';
|
import { CryptoService, DelegationDuration } from '../../services/CryptoService';
|
||||||
import { AppKit } from '@reown/appkit';
|
import { AppKit } from '@reown/appkit';
|
||||||
import { getEnsName } from '@wagmi/core';
|
import { getEnsName } from '@wagmi/core';
|
||||||
import { ChainNamespace } from '@reown/appkit-common';
|
import { ChainNamespace } from '@reown/appkit-common';
|
||||||
@ -212,7 +212,7 @@ export class ReOwnWalletService {
|
|||||||
/**
|
/**
|
||||||
* Clear delegation for the connected wallet
|
* Clear delegation for the connected wallet
|
||||||
*/
|
*/
|
||||||
clearDelegation(walletType: 'bitcoin' | 'ethereum'): void {
|
clearDelegation(): void {
|
||||||
this.cryptoService.clearDelegation();
|
this.cryptoService.clearDelegation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ export class ReOwnWalletService {
|
|||||||
async getWalletInfo(): Promise<WalletInfo | null> {
|
async getWalletInfo(): Promise<WalletInfo | null> {
|
||||||
if (this.bitcoinAccount?.isConnected) {
|
if (this.bitcoinAccount?.isConnected) {
|
||||||
return {
|
return {
|
||||||
address: this.bitcoinAccount.address,
|
address: this.bitcoinAccount.address as string,
|
||||||
walletType: 'bitcoin',
|
walletType: 'bitcoin',
|
||||||
isConnected: true
|
isConnected: true
|
||||||
};
|
};
|
||||||
@ -240,7 +240,7 @@ export class ReOwnWalletService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
address: this.ethereumAccount.address,
|
address: this.ethereumAccount.address as string,
|
||||||
walletType: 'ethereum',
|
walletType: 'ethereum',
|
||||||
ensName,
|
ensName,
|
||||||
isConnected: true
|
isConnected: true
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export async function urlLoads(url: string, timeoutMs: number = 5000): Promise<b
|
|||||||
|
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
return response.ok;
|
return response.ok;
|
||||||
} catch (error) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { NetworkConfig, ShardInfo } from "@waku/sdk";
|
import { NetworkConfig } from "@waku/sdk";
|
||||||
import { MessageType } from "./types";
|
import { MessageType } from "./types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
//TODO: perhaps store all messages in an indexed DB? (helpful when Waku is down)
|
//TODO: perhaps store all messages in an indexed DB? (helpful when Waku is down)
|
||||||
// with a `isPublished` flag to indicate if the message has been sent to the network
|
// with a `isPublished` flag to indicate if the message has been sent to the network
|
||||||
|
|
||||||
import { createDecoder, createLightNode, HealthStatus, HealthStatusChangeEvents, LightNode } from "@waku/sdk";
|
import { createLightNode, LightNode } from "@waku/sdk";
|
||||||
import { BOOTSTRAP_NODES } from "./constants";
|
|
||||||
import StoreManager from "./store";
|
import StoreManager from "./store";
|
||||||
import { CommentCache, MessageType, VoteCache, ModerateMessage } from "./types";
|
import { CommentCache, MessageType, VoteCache, ModerateMessage } from "./types";
|
||||||
import { PostCache } from "./types";
|
import { PostCache } from "./types";
|
||||||
import { CellCache } from "./types";
|
import { CellCache } from "./types";
|
||||||
import { OpchanMessage } from "@/types";
|
import { OpchanMessage } from "@/types/forum";
|
||||||
import { EphemeralProtocolsManager } from "./lightpush_filter";
|
import { EphemeralProtocolsManager } from "./lightpush_filter";
|
||||||
import { NETWORK_CONFIG } from "./constants";
|
import { NETWORK_CONFIG } from "./constants";
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { IDecodedMessage, LightNode } from "@waku/sdk";
|
import { IDecodedMessage, LightNode } from "@waku/sdk";
|
||||||
import { decodeMessage, decoders} from "./codec";
|
import { decodeMessage, decoders} from "./codec";
|
||||||
import { CONTENT_TOPICS } from "./constants";
|
|
||||||
import { CellMessage, PostMessage, CommentMessage, VoteMessage } from "./types";
|
import { CellMessage, PostMessage, CommentMessage, VoteMessage } from "./types";
|
||||||
|
|
||||||
class StoreManager {
|
class StoreManager {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { RefreshCw, Plus, TrendingUp, Clock } from 'lucide-react';
|
import { RefreshCw, TrendingUp, Clock } from 'lucide-react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export interface Cell {
|
|||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
signature?: string; // Message signature
|
signature: string; // Message signature
|
||||||
browserPubKey?: string; // Public key that signed the message
|
browserPubKey?: string; // Public key that signed the message
|
||||||
relevanceScore?: number; // Calculated relevance score
|
relevanceScore?: number; // Calculated relevance score
|
||||||
activeMemberCount?: number; // Number of active members in the cell
|
activeMemberCount?: number; // Number of active members in the cell
|
||||||
|
|||||||
@ -15,11 +15,11 @@
|
|||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": false,
|
"strict": true,
|
||||||
"noUnusedLocals": false,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": true,
|
||||||
"noFallthroughCasesInSwitch": false,
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
|||||||
@ -9,11 +9,11 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
},
|
},
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": true,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noUnusedLocals": false,
|
"noUnusedLocals": true,
|
||||||
"strictNullChecks": false
|
"strictNullChecks": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user