Skip to content

Commit

Permalink
remove turborepo
Browse files Browse the repository at this point in the history
Signed-off-by: Shreyans Jain <[email protected]>
  • Loading branch information
CodeWithShreyans committed Dec 29, 2024
1 parent ed3451b commit 914c7d5
Show file tree
Hide file tree
Showing 13 changed files with 721 additions and 522 deletions.
Empty file removed .npmrc
Empty file.
17 changes: 11 additions & 6 deletions apps/mobile/app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AsyncStorage from "@react-native-async-storage/async-storage"
import { useState } from "react"
import { useEffect, useState } from "react"
import { View } from "react-native"
import { SafeAreaView } from "react-native-safe-area-context"
import { stringSimilarity } from "string-similarity-js"
Expand All @@ -24,12 +24,14 @@ const rankSearch = async (
const searchResults: SearchResult[] = []
for (const v of guideIndex) {
const score = stringSimilarity(text, v.title)
console.log(score)
if (score > 0.2 && !v.hidden) {
searchResults.push({ ...v, hidden: !!v.hidden, score: score })
}
}
searchResults.sort((a, b) => b.score - a.score)

console.log(searchResults)
setSearchResults(searchResults)
}

Expand All @@ -38,11 +40,14 @@ export default function HomeScreen() {
const [searchResults, setSearchResults] = useState<SearchResult[]>([])
const [guideIndex, setGuideIndex] = useState<typeof GuideIndex>([])

AsyncStorage.getItem("guideIndex").then((value) => {
if (value) {
setGuideIndex(JSON.parse(value))
}
})
useEffect(() => {
AsyncStorage.getItem("guideIndex").then((value) => {
if (value) {
setGuideIndex(JSON.parse(value))
console.log(value)
}
})
}, [])

return (
<>
Expand Down
5 changes: 1 addition & 4 deletions apps/mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default function RootLayout() {
// });

registerBackgroundFetchAsync()

;(async () => {
const baseUrl = "https://content.useguider.com"
AsyncStorage.setItem("lastFetch", new Date().toISOString())
Expand All @@ -44,11 +43,9 @@ export default function RootLayout() {
if (storedIndex && deepEqual(newIndex, JSON.parse(storedIndex))) {
return
}

x
await AsyncStorage.setItem("guideIndex", JSON.stringify(newIndex))

console.log(newIndex)

for (const i of newIndex) {
const guide = await (
await fetch(`${baseUrl}/${i.slug}.json`)
Expand Down
Binary file added apps/mobile/bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion apps/mobile/components/guides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const GuidesView = ({
searchResults: SearchResult[]
guideIndex: typeof GuideIndex
}) => {
console.log(guideIndex)
return (
<View className="h-full w-screen">
<List
Expand Down
Loading

0 comments on commit 914c7d5

Please sign in to comment.