feat: unauthenticated tab

This commit is contained in:
2025-11-05 10:58:34 +01:00
parent 8180e0b375
commit e8db8d1654
15 changed files with 229 additions and 58 deletions
@@ -30,6 +30,7 @@ import { getArtistDisplayName } from '../../utils/artistName';
import { Palette } from '../../styles';
import { FONT_FAMILY } from '../../styles/Fonts';
import ProfilePicture from '../ProfilePicture';
import { ensureAuthenticated } from '../../utils/authRedirect';
let externalOpen;
let externalClose;
@@ -72,6 +73,16 @@ const CommentsBottomSheet = () => {
const [text, setText] = useState('');
const [typing, setTyping] = useState(false);
const requireAuth = useCallback(() => {
return ensureAuthenticated(currentUID, {
onIntercept: () => {
try {
modalRef.current?.dismiss?.();
} catch (_error) {}
},
});
}, [currentUID]);
useEffect(() => {
externalOpen = (pid) => {
setProjectId(pid || null);
@@ -127,7 +138,8 @@ const CommentsBottomSheet = () => {
const onSend = async () => {
const value = (text || '').trim();
if (!value || !projectId || !currentUID) return;
if (!value || !projectId) return;
if (!requireAuth()) return;
try {
setText('');
const docRef = await projectsRef
@@ -354,11 +366,23 @@ const CommentsBottomSheet = () => {
placeholderTextColor='#FFFFFFAA'
value={text}
onChangeText={(t) => {
if (!currentUID && !requireAuth()) {
return;
}
setText(t);
}}
onFocus={() => {
if (!requireAuth()) {
setTyping(false);
return;
}
setTyping(true);
}}
onPressIn={() => {
if (!requireAuth()) {
setTyping(false);
}
}}
onBlur={() => setTyping(false)}
style={{
flex: 1,