Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/expo/assets/article-brief/data-control.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 32 additions & 2 deletions apps/expo/src/app/(tabs)/elections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export default function ElectionsScreen() {
const voterInfoQuery = useQuery({
...trpc.civic.getVoterInfo.queryOptions({ address: storedAddress ?? "" }),
enabled: hasAddress,
retry: 1,
});

// We only have ballot/results data sourced for California right now.
Expand Down Expand Up @@ -300,10 +301,23 @@ export default function ElectionsScreen() {
/>
)}

<RepsSection address={storedAddress} />
<RepsSection
address={storedAddress}
enabled={hasVerifiedCaliforniaAddress}
/>

{voterInfoQuery.isLoading && (
<ActivityIndicator color={colors.bill} style={{ marginVertical: 12 }} />
<View style={s.section}>
<Card style={s.lookupCard}>
<ActivityIndicator color={colors.bill} />
<View style={s.lookupCopy}>
<Text style={s.lookupTitle}>Looking up your ballot</Text>
<Text style={s.lookupSub}>
Checking your election and elected officials…
</Text>
</View>
</Card>
</View>
)}

{/* ballot section tabs */}
Expand Down Expand Up @@ -518,6 +532,22 @@ const s = StyleSheet.create({
},
addrEdit: { fontFamily: fontBody.semibold, fontSize: 13, color: colors.bill },
section: { paddingHorizontal: 20 },
lookupCard: {
flexDirection: "row",
alignItems: "center",
gap: 13,
},
lookupCopy: { flex: 1, gap: 2 },
lookupTitle: {
fontFamily: fontBody.semibold,
fontSize: 14,
color: colors.white,
},
lookupSub: {
fontFamily: fontBody.regular,
fontSize: 12.5,
color: colors.textSecondary,
},
contestOffice: {
fontFamily: "InriaSerif-Bold",
fontSize: 16,
Expand Down
42 changes: 29 additions & 13 deletions apps/expo/src/app/(tabs)/feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
} from "~/styles";
import { queryClient, trpc, trpcClient } from "~/utils/api";
import { authClient } from "~/utils/auth";
import { editorialVisualFor } from "~/utils/editorial-visuals";

const { height: SCREEN_H, width: SCREEN_W } = Dimensions.get("window");

Expand Down Expand Up @@ -117,6 +118,10 @@ function FeedCard({

const typeKey = resolveType(item.type);
const t = contentType[typeKey];
const imageSource = editorialVisualFor(
item.title,
item.imageUri ?? item.thumbnailUrl,
);

return (
<LinearGradient
Expand All @@ -141,10 +146,10 @@ function FeedCard({
</View>

{/* hero */}
{(item.imageUri ?? item.thumbnailUrl) ? (
{imageSource ? (
<Image
style={s.hero}
source={{ uri: item.imageUri ?? item.thumbnailUrl }}
source={imageSource}
contentFit="cover"
transition={300}
/>
Expand All @@ -169,16 +174,17 @@ function FeedCard({
</Text>
) : null}

{/* key-fact chips — TODO(backend): real stat/status/chamber per item */}
<View style={s.chips}>
<View style={[s.chip, { flex: 1 }]}>
<Text style={[s.chipStat, { color: t.color }]}>{t.label}</Text>
<Text style={s.chipLabel}>type</Text>
{/* Type is already established by the badge. Give the remaining metadata
row one reader-useful job: identify where the record came from. */}
<View style={s.sourceCard}>
<View style={[s.sourceIcon, { backgroundColor: `${t.color}20` }]}>
<Icon name="globe" size={16} color={t.color} />
</View>
<View style={[s.chip, { flex: 1.4 }]}>
<View style={s.sourceCopy}>
<Text style={s.chipStatus}>{item.author || "Public record"}</Text>
<Text style={s.chipLabel}>source</Text>
<Text style={s.chipLabel}>Original source</Text>
</View>
<Icon name="chevR" size={16} color={colors.textSecondary} />
</View>

{/* dual-lens strip */}
Expand Down Expand Up @@ -394,16 +400,26 @@ const s = StyleSheet.create({
color: "rgba(255,255,255,0.82)",
marginBottom: 18,
},
chips: { flexDirection: "row", gap: 10, marginBottom: 18 },
chip: {
sourceCard: {
flexDirection: "row",
alignItems: "center",
gap: 11,
backgroundColor: planes.slate,
borderWidth: 1,
borderColor: hair[1],
borderRadius: 12,
paddingVertical: 10,
paddingHorizontal: 14,
paddingHorizontal: 12,
marginBottom: 18,
},
sourceIcon: {
width: 34,
height: 34,
borderRadius: 9,
alignItems: "center",
justifyContent: "center",
},
chipStat: { fontFamily: "IBMPlexSerif-Bold", fontSize: 20 },
sourceCopy: { flex: 1, minWidth: 0 },
chipStatus: {
fontFamily: fontBody.semibold,
fontSize: 13.5,
Expand Down
8 changes: 6 additions & 2 deletions apps/expo/src/app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ export default function BrowseScreen() {
// election list (which surfaced out-of-state elections like "North Dakota
// Primary"). Use the address they set on the Elections tab — getVoterInfo
// returns the election relevant to that address. Banner stays hidden until
// an address is set.
// an address is set. Skip this nonessential background lookup in local
// development: Civic credentials are commonly absent/disabled there, and a
// failed banner request otherwise floods the Expo error overlay even after
// navigating away from this tab. The Elections screen still performs its
// own lookup when that flow is being developed.
const { address } = useUserAddress();
const voterInfoQuery = useQuery({
...trpc.civic.getVoterInfo.queryOptions({ address: address ?? "" }),
enabled: !!address,
enabled: !!address && !__DEV__,
});
const election = voterInfoQuery.data?.election;
const upcomingElection =
Expand Down
5 changes: 4 additions & 1 deletion apps/expo/src/app/(tabs)/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ function buildGroups(
export default function SettingsScreen() {
const router = useRouter();
const sessionQuery = useQuery(trpc.auth.getSession.queryOptions());
const prefsQuery = useQuery(trpc.user.getPreferences.queryOptions());
const prefsQuery = useQuery({
...trpc.user.getPreferences.queryOptions(),
enabled: !!sessionQuery.data?.user,
});

const sessionUser = sessionQuery.data?.user;
const profileName = sessionUser?.name ?? "Guest";
Expand Down
Loading
Loading