mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +00:00
fix: author verification
This commit is contained in:
parent
c8aa4878ca
commit
1d5015d7d6
@ -9,13 +9,16 @@ interface LinkRendererProps {
|
||||
* Component that renders text with clickable links
|
||||
* Detects URLs and converts them to clickable <a> tags
|
||||
*/
|
||||
export const LinkRenderer: React.FC<LinkRendererProps> = ({ text, className }) => {
|
||||
export const LinkRenderer: React.FC<LinkRendererProps> = ({
|
||||
text,
|
||||
className,
|
||||
}) => {
|
||||
// URL regex pattern that matches http/https URLs
|
||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||
|
||||
|
||||
// Split text by URLs and create array of text segments and URLs
|
||||
const parts = text.split(urlRegex);
|
||||
|
||||
|
||||
return (
|
||||
<span className={className}>
|
||||
{parts.map((part, index) => {
|
||||
|
||||
@ -15,7 +15,6 @@ import {
|
||||
import { localDatabase } from '@/lib/database/LocalDatabase';
|
||||
import { useAppKitAccount, useDisconnect, modal } from '@reown/appkit/react';
|
||||
|
||||
// Removed VerificationStatus type - using EVerificationStatus enum directly
|
||||
|
||||
interface AuthContextType {
|
||||
currentUser: User | null;
|
||||
|
||||
@ -284,18 +284,12 @@ export class RelevanceCalculator {
|
||||
return { bonus: 0, isVerified: false };
|
||||
}
|
||||
|
||||
// Apply different bonuses based on verification level
|
||||
// Apply different bonuses based on verification signals from UserVerificationStatus
|
||||
// Full bonus if author owns ENS or Ordinal. Otherwise, if merely verified (wallet connected), apply basic bonus
|
||||
let bonus = 0;
|
||||
if (
|
||||
authorStatus?.verificationStatus ===
|
||||
EVerificationStatus.ENS_ORDINAL_VERIFIED
|
||||
) {
|
||||
// Full bonus for ENS/Ordinal owners
|
||||
if (authorStatus?.hasENS || authorStatus?.hasOrdinal) {
|
||||
bonus = score * (RelevanceCalculator.VERIFICATION_BONUS - 1);
|
||||
} else if (
|
||||
authorStatus?.verificationStatus === EVerificationStatus.WALLET_CONNECTED
|
||||
) {
|
||||
// Lower bonus for basic verified users
|
||||
} else if (authorStatus?.isVerified) {
|
||||
bonus = score * (RelevanceCalculator.BASIC_VERIFICATION_BONUS - 1);
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,9 @@ export default function ProfilePage() {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [callSign, setCallSign] = useState('');
|
||||
const [displayPreference, setDisplayPreference] = useState(EDisplayPreference.WALLET_ADDRESS);
|
||||
const [displayPreference, setDisplayPreference] = useState(
|
||||
EDisplayPreference.WALLET_ADDRESS
|
||||
);
|
||||
const [walletWizardOpen, setWalletWizardOpen] = useState(false);
|
||||
|
||||
// Initialize and update local state when user data changes
|
||||
@ -67,8 +69,11 @@ export default function ProfilePage() {
|
||||
if (currentUser) {
|
||||
// Use the same data source as the display (userInfo) for consistency
|
||||
const currentCallSign = userInfo.callSign || currentUser.callSign || '';
|
||||
const currentDisplayPreference = userInfo.displayPreference || currentUser.displayPreference || EDisplayPreference.WALLET_ADDRESS;
|
||||
|
||||
const currentDisplayPreference =
|
||||
userInfo.displayPreference ||
|
||||
currentUser.displayPreference ||
|
||||
EDisplayPreference.WALLET_ADDRESS;
|
||||
|
||||
setCallSign(currentCallSign);
|
||||
setDisplayPreference(currentDisplayPreference);
|
||||
}
|
||||
@ -174,8 +179,11 @@ export default function ProfilePage() {
|
||||
const handleCancel = () => {
|
||||
// Reset to the same data source as display for consistency
|
||||
const currentCallSign = userInfo.callSign || currentUser.callSign || '';
|
||||
const currentDisplayPreference = userInfo.displayPreference || currentUser.displayPreference || EDisplayPreference.WALLET_ADDRESS;
|
||||
|
||||
const currentDisplayPreference =
|
||||
userInfo.displayPreference ||
|
||||
currentUser.displayPreference ||
|
||||
EDisplayPreference.WALLET_ADDRESS;
|
||||
|
||||
setCallSign(currentCallSign);
|
||||
setDisplayPreference(currentDisplayPreference);
|
||||
setIsEditing(false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user