Compare commits
3 Commits
03161a52ca
...
ae8c7392b5
Author | SHA1 | Date | |
---|---|---|---|
ae8c7392b5
|
|||
67bb6e0028
|
|||
75cdd241d2
|
@@ -22,18 +22,9 @@ export default function App() {
|
|||||||
const [showAskAI, setShowAskAI] = useState(false)
|
const [showAskAI, setShowAskAI] = useState(false)
|
||||||
const [showTestUI, setShowTestUI] = useState(false)
|
const [showTestUI, setShowTestUI] = useState(false)
|
||||||
|
|
||||||
// Check if current page has matching chat records (AI posts always have chat records)
|
// Simple detection: if the URL contains a date+hash pattern, it's likely an AI post
|
||||||
const isAiPost = !pageContext.isTopPage && Array.isArray(adminChatRecords) && adminChatRecords.some(chatPair => {
|
const isAiPost = !pageContext.isTopPage && pageContext.rkey &&
|
||||||
const recordUrl = chatPair.question?.value?.post?.url
|
/^\d{4}-\d{2}-\d{2}-[a-f0-9]{8}$/.test(pageContext.rkey)
|
||||||
if (!recordUrl) return false
|
|
||||||
|
|
||||||
try {
|
|
||||||
const recordRkey = new URL(recordUrl).pathname.split('/').pop()?.replace(/\.html$/, '')
|
|
||||||
return recordRkey === pageContext.rkey
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Environment-based feature flags
|
// Environment-based feature flags
|
||||||
const ENABLE_TEST_UI = import.meta.env.VITE_ENABLE_TEST_UI === 'true'
|
const ENABLE_TEST_UI = import.meta.env.VITE_ENABLE_TEST_UI === 'true'
|
||||||
|
@@ -6,18 +6,9 @@ import LoadingSkeleton from './LoadingSkeleton.jsx'
|
|||||||
import { logger } from '../utils/logger.js'
|
import { logger } from '../utils/logger.js'
|
||||||
|
|
||||||
export default function RecordTabs({ langRecords, commentRecords, userComments, chatRecords, chatHasMore, onLoadMoreChat, userChatRecords, userChatLoading, baseRecords, apiConfig, pageContext, user = null, agent = null, onRecordDeleted = null }) {
|
export default function RecordTabs({ langRecords, commentRecords, userComments, chatRecords, chatHasMore, onLoadMoreChat, userChatRecords, userChatLoading, baseRecords, apiConfig, pageContext, user = null, agent = null, onRecordDeleted = null }) {
|
||||||
// Check if current page has matching chat records (AI posts always have chat records)
|
// Simple detection: if the URL contains a date+hash pattern, it's likely an AI post
|
||||||
const isAiPost = !pageContext.isTopPage && Array.isArray(chatRecords) && chatRecords.some(chatPair => {
|
const isAiPost = !pageContext.isTopPage && pageContext.rkey &&
|
||||||
const recordUrl = chatPair.question?.value?.post?.url
|
/^\d{4}-\d{2}-\d{2}-[a-f0-9]{8}$/.test(pageContext.rkey)
|
||||||
if (!recordUrl) return false
|
|
||||||
|
|
||||||
try {
|
|
||||||
const recordRkey = new URL(recordUrl).pathname.split('/').pop()?.replace(/\.html$/, '')
|
|
||||||
return recordRkey === pageContext.rkey
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState(isAiPost ? 'collection' : 'profiles')
|
const [activeTab, setActiveTab] = useState(isAiPost ? 'collection' : 'profiles')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user