Compare commits
2 Commits
ae8c7392b5
...
03161a52ca
Author | SHA1 | Date | |
---|---|---|---|
03161a52ca
|
|||
fe9381a860
|
@@ -22,9 +22,18 @@ export default function App() {
|
|||||||
const [showAskAI, setShowAskAI] = useState(false)
|
const [showAskAI, setShowAskAI] = useState(false)
|
||||||
const [showTestUI, setShowTestUI] = useState(false)
|
const [showTestUI, setShowTestUI] = useState(false)
|
||||||
|
|
||||||
// Simple detection: if the URL contains a date+hash pattern, it's likely an AI post
|
// Check if current page has matching chat records (AI posts always have chat records)
|
||||||
const isAiPost = !pageContext.isTopPage && pageContext.rkey &&
|
const isAiPost = !pageContext.isTopPage && Array.isArray(adminChatRecords) && adminChatRecords.some(chatPair => {
|
||||||
/^\d{4}-\d{2}-\d{2}-[a-f0-9]{8}$/.test(pageContext.rkey)
|
const recordUrl = chatPair.question?.value?.post?.url
|
||||||
|
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,9 +6,18 @@ 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 }) {
|
||||||
// Simple detection: if the URL contains a date+hash pattern, it's likely an AI post
|
// Check if current page has matching chat records (AI posts always have chat records)
|
||||||
const isAiPost = !pageContext.isTopPage && pageContext.rkey &&
|
const isAiPost = !pageContext.isTopPage && Array.isArray(chatRecords) && chatRecords.some(chatPair => {
|
||||||
/^\d{4}-\d{2}-\d{2}-[a-f0-9]{8}$/.test(pageContext.rkey)
|
const recordUrl = chatPair.question?.value?.post?.url
|
||||||
|
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