Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/expo/app/(app)/(tabs)/(home)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { clientEnvs } from 'expo-app/env/clientEnvs';
import { AIChatTile } from 'expo-app/features/ai/components/AIChatTile';
import { ReportedContentTile } from 'expo-app/features/ai/components/ReportedContentTile';
import { AIPacksTile } from 'expo-app/features/ai-packs/components/AIPacksTile';
import { GuidesTile } from 'expo-app/features/guides/components/GuidesTile';
import { FeedTile } from 'expo-app/features/feed/components/FeedTile';
import { GuidesTile } from 'expo-app/features/guides/components/GuidesTile';
import { PackTemplatesTile } from 'expo-app/features/pack-templates/components/PackTemplatesTile';
import { CurrentPackTile } from 'expo-app/features/packs/components/CurrentPackTile';
import { GearInventoryTile } from 'expo-app/features/packs/components/GearInventoryTile';
Expand Down
8 changes: 4 additions & 4 deletions apps/expo/app/(app)/feed/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PostDetailScreen } from 'expo-app/features/feed';
import { userStore } from 'expo-app/features/auth/store';
import { Text } from '@packrat/ui/nativewindui';
import { useLocalSearchParams } from 'expo-router';
import { useQuery } from '@tanstack/react-query';
import { userStore } from 'expo-app/features/auth/store';
import { PostDetailScreen } from 'expo-app/features/feed';
import type { Post } from 'expo-app/features/feed/types';
import axiosInstance from 'expo-app/lib/api/client';
import { useLocalSearchParams } from 'expo-router';
import { ActivityIndicator, View } from 'react-native';
import type { Post } from 'expo-app/features/feed/types';

export default function PostDetailRoute() {
const { id } = useLocalSearchParams<{ id: string }>();
Expand Down
5 changes: 3 additions & 2 deletions apps/expo/features/ai/lib/localModelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async function _isLlamaModelAvailable(): Promise<boolean> {

// ─── Apple Dynamic Import ───────────────────────────────────────────────────

// biome-ignore lint/suspicious/noExplicitAny: dynamic import type unknown
let appleModule: any = null;

function getAppleModule() {
Expand All @@ -66,9 +67,9 @@ function getAppleModule() {
// ─── Singletons ─────────────────────────────────────────────────────────────

let llamaModel: LlamaLanguageModel | null = null;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// biome-ignore lint/suspicious/noExplicitAny: Apple module type unknown
let appleModel: any = null;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// biome-ignore lint/suspicious/noExplicitAny: download task type unknown
let activeDownloadTask: any = null;
let _isCancellingDownload = false;

Expand Down
1 change: 1 addition & 0 deletions apps/expo/features/auth/store/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ syncObservable(
syncedCrud({
persist: {
name: 'user',
// biome-ignore lint/suspicious/noExplicitAny: Storage type mismatch with legend-state plugin
plugin: observablePersistSqlite(Storage as any),
},
}),
Expand Down
1 change: 1 addition & 0 deletions apps/expo/features/feed/components/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const PostCard: React.FC<PostCardProps> = ({ post, onLike, onDelete, curr
style={styles.imageScroll}
>
{post.images.map((img, idx) => (
// biome-ignore lint/suspicious/noArrayIndexKey: images have no stable id
<Image
key={`${img}-${idx}`}
source={{ uri: buildPostImageUrl(img) }}
Expand Down
7 changes: 3 additions & 4 deletions apps/expo/features/feed/hooks/usePostComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ export const usePostComments = (postId: number) => {
return useInfiniteQuery({
queryKey: ['feed', postId, 'comments'],
queryFn: async ({ pageParam = 1 }) => {
const response = await axiosInstance.get<CommentsResponse>(
`/api/feed/${postId}/comments`,
{ params: { page: pageParam, limit: 20 } },
);
const response = await axiosInstance.get<CommentsResponse>(`/api/feed/${postId}/comments`, {
params: { page: pageParam, limit: 20 },
});
return response.data;
},
getNextPageParam: (lastPage) => {
Expand Down
12 changes: 4 additions & 8 deletions apps/expo/features/feed/screens/CreatePostScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ export const CreatePostScreen = ({ onSuccess }: { onSuccess?: () => void }) => {
const asset = result.assets[0];
if (asset) {
setPhotos((prev) =>
[
...prev,
{ uri: asset.uri, fileName: `camera_${Date.now()}.jpg` },
].slice(0, 10),
[...prev, { uri: asset.uri, fileName: `camera_${Date.now()}.jpg` }].slice(0, 10),
);
}
}
Expand All @@ -104,7 +101,7 @@ export const CreatePostScreen = ({ onSuccess }: { onSuccess?: () => void }) => {
const results = await Promise.all(
photos.map(async (photo) => {
const ext = photo.fileName.includes('.')
? photo.fileName.split('.').pop()?.toLowerCase() ?? 'jpg'
? (photo.fileName.split('.').pop()?.toLowerCase() ?? 'jpg')
: 'jpg';
const uniqueName = `${nanoid()}.${ext}`;
return uploadImage(uniqueName, photo.uri);
Expand Down Expand Up @@ -148,6 +145,7 @@ export const CreatePostScreen = ({ onSuccess }: { onSuccess?: () => void }) => {
{/* Photo grid */}
<View className="flex-row flex-wrap gap-2 mb-4">
{photos.map((photo, idx) => (
// biome-ignore lint/suspicious/noArrayIndexKey: photos have no stable id
<View key={`${photo.uri}-${idx}`} className="relative">
<Image
source={{ uri: photo.uri }}
Expand Down Expand Up @@ -196,9 +194,7 @@ export const CreatePostScreen = ({ onSuccess }: { onSuccess?: () => void }) => {
className="text-foreground text-sm min-h-[80px]"
style={{ color: colors.foreground }}
/>
<Text className="text-xs text-muted-foreground text-right mt-1">
{caption.length}/2000
</Text>
<Text className="text-xs text-muted-foreground text-right mt-1">{caption.length}/2000</Text>
</View>

{/* Submit */}
Expand Down
15 changes: 3 additions & 12 deletions apps/expo/features/feed/screens/FeedScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@ export const FeedScreen = () => {
const router = useRouter();
const currentUserId = userStore.id.peek() as number | undefined;

const {
data,
isLoading,
isRefetching,
refetch,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
} = useFeed();
const { data, isLoading, isRefetching, refetch, fetchNextPage, hasNextPage, isFetchingNextPage } =
useFeed();

const { mutate: toggleLike } = useTogglePostLike();
const { mutate: deletePost } = useDeletePost();
Expand Down Expand Up @@ -113,9 +106,7 @@ export const FeedScreen = () => {
renderItem={renderItem}
keyExtractor={(item) => String(item.id)}
contentContainerStyle={{ paddingHorizontal: 16, paddingTop: 8, paddingBottom: 24 }}
refreshControl={
<RefreshControl refreshing={isRefetching} onRefresh={refetch} />
}
refreshControl={<RefreshControl refreshing={isRefetching} onRefresh={refetch} />}
onEndReached={handleLoadMore}
onEndReachedThreshold={0.3}
ListFooterComponent={renderFooter}
Expand Down
1 change: 1 addition & 0 deletions apps/expo/features/feed/screens/PostDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const PostDetailScreen = ({ post, currentUserId }: PostDetailScreenProps)
style={styles.imageScroll}
>
{post.images.map((img, idx) => (
// biome-ignore lint/suspicious/noArrayIndexKey: images have no stable id
<Image
key={`${img}-${idx}`}
source={{ uri: buildPostImageUrl(img) }}
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/features/trips/screens/TripListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function TrailConditionsBanner() {
<View className="mx-4 mb-2 mt-3 flex-row items-center justify-between rounded-xl bg-violet-500/10 px-4 py-3">
<View className="flex-row items-center">
<View className="h-8 w-8 items-center justify-center rounded-full bg-violet-500">
<Icon name="terrain" size={18} color="white" />
<Icon name="map" size={18} color="white" />
</View>
<View className="ml-3">
<Text className="font-semibold text-foreground">{t('trips.trailConditions')}</Text>
Expand Down
11 changes: 6 additions & 5 deletions apps/expo/features/wildlife/hooks/useWildlifeHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ export function useWildlifeHistory() {
const [, setHistory] = useAtom(baseWildlifeHistoryAtom);

const addIdentification = useCallback(
async (
imageUri: string,
results: IdentificationResult[],
location?: WildlifeIdentification['location'],
) => {
async (opts: {
imageUri: string;
results: IdentificationResult[];
location?: WildlifeIdentification['location'];
}) => {
const { imageUri, results, location } = opts;
const entry: WildlifeIdentification = {
id: nanoid(),
imageUri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function IdentificationScreen() {
} catch (err) {
console.warn('Failed to persist image locally, using original URI:', err);
}
await addIdentification(persistedUri, identificationResults);
await addIdentification({ imageUri: persistedUri, results: identificationResults });
},
},
);
Expand Down
42 changes: 21 additions & 21 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
"packages/api/test/guides.test.ts",
"packages/api/test/setup.ts",
"apps/expo/utils/weight.ts",
"packages/api/src/utils/weight.ts"
"packages/api/src/utils/weight.ts",
"scripts/lint/**",
".github/scripts/**"
],
"linter": {
"rules": {
Expand All @@ -76,6 +78,23 @@
}
}
}
},
{
"includes": [
"**/__tests__/**",
"**/test/**",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
}
}
],
"css": {
Expand All @@ -97,24 +116,5 @@
"organizeImports": "on"
}
}
},
"overrides": [
{
"includes": [
"**/__tests__/**",
"**/test/**",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
}
}
]
}
}
7 changes: 2 additions & 5 deletions packages/api/src/routes/feed/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { createDb } from '@packrat/api/db';
import { commentLikes, postComments, posts, users } from '@packrat/api/db/schema';
import { ErrorResponseSchema } from '@packrat/api/schemas/catalog';
import {
CommentsResponseSchema,
CommentSchema,
CommentsResponseSchema,
CreateCommentRequestSchema,
LikeToggleResponseSchema,
} from '@packrat/api/schemas/feed';
Expand Down Expand Up @@ -54,10 +54,7 @@ commentsRoutes.openapi(listCommentsRoute, async (c) => {
const offset = (page - 1) * limit;

const [totalResult, items] = await Promise.all([
db
.select({ count: count() })
.from(postComments)
.where(eq(postComments.postId, postId)),
db.select({ count: count() }).from(postComments).where(eq(postComments.postId, postId)),
db
.select({
id: postComments.id,
Expand Down
Loading