Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type/fix app #1403

Merged
merged 9 commits into from
Jan 6, 2025
Merged
2 changes: 1 addition & 1 deletion apps/bun-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const main = new Hono()

serve(
{
fetch: main.fetch,
// fetch: main.fetch,
port: 8085,
...main,
},
Expand Down
2 changes: 1 addition & 1 deletion apps/bun-server/src/models/itemCategory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Schema, model } from 'mongoose';
import { ItemCategory } from '../utils/itemCategory';
import { ItemCategory } from '../utils/constants';
import myDB from './dbConnection';
const itemCategorySchema = new Schema(
{
Expand Down
7 changes: 6 additions & 1 deletion apps/bun-server/src/models/userModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import mongoose, { Schema, type Document, type Model } from 'mongoose';
import myDB from './dbConnection';
import bcrypt from 'bcryptjs';
import * as jwt from 'hono/jwt';
import { JWT_SECRET, CLIENT_URL } from '../config';
// import { JWT_SECRET, CLIENT_URL } from '../config';

// Dummy implementation of config
const JWT_SECRET = 'dummy_jwt_secret';
const CLIENT_URL = 'http://localhost:4200';

import validator from 'validator';

export interface IUser extends Document {
Expand Down
12 changes: 12 additions & 0 deletions apps/bun-server/src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const ItemCategory = {
FOOD: 'Food',
WATER: 'Water',
ESSENTIALS: 'Essentials',
// CLOTHING: 'Clothing',
// SHELTER: 'Shelter',
// SLEEPING: 'Sleeping',
// HYGIENE: 'Hygiene',
// TOOLS: 'Tools',
// MEDICAL: 'Medical',
// OTHER: 'Other',
};
24 changes: 24 additions & 0 deletions apps/bun-server/src/utils/convertWeight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export type WeightUnit = 'g' | 'kg' | 'oz' | 'lb' | 'lbs';

export const convertWeight = (
weight: number,
fromUnit: WeightUnit,
toUnit: WeightUnit,
): number => {
if (typeof weight !== 'number' || !fromUnit || !toUnit) {
return 0; // return 0 if weight is not a number or any of the units are missing
}

const units: Record<WeightUnit, number> = {
g: 1,
kg: 1000,
oz: 28.3495,
lb: 453.592,
lbs: 453.592,
};

const weightInGrams = weight * units[fromUnit];
const convertedWeight = weightInGrams / units[toUnit];

return Number(convertedWeight.toFixed(2));
};
11 changes: 10 additions & 1 deletion apps/bun-server/src/workers/osmWorker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { findOrCreateMany } from '../utils/osmFunctions/modelHandlers';
// import { findOrCreateMany } from '../utils/osmFunctions/modelHandlers';

// Dummy implementation of findOrCreateMany
async function findOrCreateMany(features) {
// Simulate processing features
return features.map((feature) => ({
...feature,
id: Math.random().toString(36).substr(2, 9),
}));
}

/**
* Process a job and return the result.
Expand Down
36 changes: 18 additions & 18 deletions apps/next/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,24 @@ function MyApp({ Component, pageProps }: SolitoAppProps) {
);
}

function ThemeProvider({ children }: { children: React.ReactNode }) {
const [theme, setTheme] = useRootTheme();
// function ThemeProvider({ children }: { children: React.ReactNode }) {
// const [theme, setTheme] = useRootTheme();

return (
<NextThemeProvider
onChangeTheme={(next) => {
setTheme(next as any);
}}
>
<TamaguiProvider
disableRootThemeClass
defaultTheme={theme}
config={config}
>
{children}
</TamaguiProvider>
</NextThemeProvider>
);
}
// return (
// <NextThemeProvider
// onChangeTheme={(next) => {
// setTheme(next as any);
// }}
// >
// <TamaguiProvider
// disableRootThemeClass
// defaultTheme={theme}
// config={config}
// >
// {children}
// </TamaguiProvider>
// </NextThemeProvider>
// );
// }

export default MyApp;
2 changes: 1 addition & 1 deletion apps/next/pages/destination/[destinationId].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DestinationScreen } from 'app/modules/Map/screens/DestinationScreen';
import { DestinationScreen } from 'app/modules/map/screens/DestinationScreen';
import { AuthWrapper } from 'app/modules/auth';

// export const runtime = 'experimental-edge';
Expand Down
2 changes: 1 addition & 1 deletion apps/next/pages/profile/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { StyleSheet, Text, View, Platform } from 'react-native';
import ProfileContainer from 'app/screens/user/ProfileContainer';
import { ProfileContainer } from 'app/modules/user/widgets/ProfileContainer';
import { useProfileId } from 'app/modules/user';
import { AuthWrapper } from 'app/modules/auth';

Expand Down
2 changes: 1 addition & 1 deletion apps/next/pages/profile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ProfileContainer from 'app/screens/user/ProfileContainer';
import { ProfileContainer } from 'app/modules/user/widgets/ProfileContainer';
import { AuthWrapper } from 'app/modules/auth';

// export const runtime = 'experimental-edge'
Expand Down
4 changes: 2 additions & 2 deletions apps/tauri/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { StrictMode } from 'react';
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import { RouterProvider, createRouter } from '@tanstack/react-router';
import './styles/global.css';

// Import the generated route tree
import { routeTree } from './routeTree.gen';
import { routeTree } from './routeTree.gen.ts';

// Create a new router instance
const router = createRouter({ routeTree });
Expand Down
5 changes: 2 additions & 3 deletions apps/tauri/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import { MainContentWeb } from '@packrat/ui';
import { createRootRoute, Link, Outlet } from '@tanstack/react-router';
import { createRootRoute, Outlet } from '@tanstack/react-router';
import { TanStackRouterDevtools } from '@tanstack/router-devtools';
import { NavbarTauri } from 'app/components/navigation';
import { Provider } from 'app/provider';
import { View } from 'react-native';
import { FullSideBar } from 'app/components/navigation/SideBar';
// import { FullSideBar } from 'app/components/navigation/SideBar';

export const Route = createRootRoute({
component: () => (
Expand Down
3 changes: 1 addition & 2 deletions apps/tauri/src/routes/destination/query.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { DestinationScreen } from 'app/modules/Map/screens/DestinationScreen';
import { DestinationScreen } from 'app/modules/map/screens/DestinationScreen';
import { AuthWrapper } from 'app/modules/auth';
// import DestinationPage from "../../components/destination";
import { createLazyFileRoute } from '@tanstack/react-router';
Expand Down
4 changes: 2 additions & 2 deletions apps/tauri/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"module": "NodeNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
Expand Down
4 changes: 2 additions & 2 deletions apps/tauri/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowSyntheticDefaultImports": true,
"strict": true
},
Expand Down
6 changes: 3 additions & 3 deletions apps/vite/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { StrictMode } from 'react';
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import { RouterProvider, createRouter } from '@tanstack/react-router';
import * as WebBrowser from 'expo-web-browser';
import './styles/global.css';

// Import the generated route tree
import { routeTree } from './routeTree.gen';
import { routeTree } from './routeTree.gen.ts';

// Create a new router instance
const router = createRouter({ routeTree });
Expand All @@ -25,7 +25,7 @@ if (!rootElement.innerHTML) {
const root = ReactDOM.createRoot(rootElement);
root.render(
<StrictMode>
<RouterProvider router={router} />
<RouterProvider router={router as any} />
</StrictMode>,
);
}
6 changes: 3 additions & 3 deletions apps/vite/src/routes/trip/$tripId.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import EditTripScreen from 'app/screens/trip/editTrip';
import { AuthWrapper } from 'app/modules/auth';
import { createLazyFileRoute } from '@tanstack/react-router';
Expand All @@ -8,10 +7,11 @@ export const Route = createLazyFileRoute('/trip/$tripId')({
});

export default function Trip() {
const { tripId } = Route.useParams();
// const { tripId } = Route.useParams();
return (
<AuthWrapper>
<EditTripScreen tripId={tripId} />
{/* <EditTripScreen tripId={tripId} /> */}
<EditTripScreen />
</AuthWrapper>
);
}
4 changes: 2 additions & 2 deletions apps/vite/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"module": "NodeNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
Expand Down
4 changes: 2 additions & 2 deletions apps/vite/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowSyntheticDefaultImports": true,
"strict": true
},
Expand Down
12 changes: 11 additions & 1 deletion packages/app/components/Fab/FabNative.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ import useTheme from 'app/hooks/useTheme';
import { QuickActionButton } from 'app/modules/dashboard/components/QuickActionButton/QuickActionButton';
import { RButton } from '@packrat/ui';

const FABNative = () => {
interface FABProps {
showQuickActions: boolean;
toggleQuickActions: () => void;
closeQuickActions: () => void;
}

const FABNative: React.FC<FABProps> = ({
showQuickActions,
toggleQuickActions,
closeQuickActions,
}) => {
const { handleActionSelect, quickActionData } = useQuickActions();
const { currentTheme } = useTheme();

Expand Down
12 changes: 11 additions & 1 deletion packages/app/components/Fab/FabWeb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ import { RButton, RText } from '@packrat/ui';
import { MaterialIcons } from '@expo/vector-icons';
import useTheme from 'app/hooks/useTheme';

const FABWeb = () => {
interface FABProps {
showQuickActions: boolean;
toggleQuickActions: () => void;
closeQuickActions: () => void;
}

const FABWeb: React.FC<FABProps> = ({
showQuickActions,
toggleQuickActions,
closeQuickActions,
}) => {
const { handleActionSelect, quickActionData } = useQuickActions();
const { currentTheme } = useTheme();

Expand Down
2 changes: 1 addition & 1 deletion packages/app/components/FilterBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const FilterBadge = ({
}))}
menuName={selectedValue}
trigger={
<Chip rounded theme="primary" size="small" key={selectedValue}>
<Chip rounded size="small" key={selectedValue}>
<Chip.Text>{selectedValue}</Chip.Text>
<Chip.Icon>
<ChevronDown size={14} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface PlacesAutocompleteProps {
onSelect?: (geoJSON: any) => void;
placeholder?: string;
shouldNavigateBackOnClear?: any;
style?: any;
}

export const PlacesAutocomplete = forwardRef<any, PlacesAutocompleteProps>(
Expand Down
24 changes: 13 additions & 11 deletions packages/app/components/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { SearchResults } from './SearchResults';

const Popover = OriginalPopover;
const RStack = OriginalRStack;
const RInput = OriginalRInput;
const RInput: any = OriginalRInput;
const RScrollView = OriginalRScrollView;
const RButton = OriginalRButton;
const Pressable = OriginalPressable;
Expand All @@ -34,7 +34,7 @@ interface SearchInputProps {
onCreate: (result: any, index: number) => void;
results: any[];
onChange: (text: string) => void;
searchString?: string;
searchString: string;
placeholder?: string;
canCreateNewItem?: boolean;
resultItemComponent: React.ReactElement;
Expand Down Expand Up @@ -114,15 +114,17 @@ export const SearchInput = forwardRef<TextInput, SearchInputProps>(
{(searchString || isFocused) && (
<MaterialIcons
name="close"
style={{
position: 'absolute',
right: 12,
top: '50%',
transform: 'translateY(-50%)',
fontSize: 20,
color: currentTheme.colors.text,
cursor: 'pointer',
}}
style={
{
position: 'absolute',
right: 12,
top: '50%',
transform: 'translateY(-50%)',
fontSize: 20,
color: currentTheme.colors.text,
cursor: 'pointer',
} as any
}
onClick={handleClearSearch}
/>
)}
Expand Down
7 changes: 2 additions & 5 deletions packages/app/components/Suggestion/SuggestionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ interface SuggestionItem {
}

interface SuggestionListProps {
suggestion: { Items: SuggestionItem[] } | null;
suggestion: SuggestionItem[];
onAddItem: (itemId: string) => void;
}

export function SuggestionList({ suggestion, onAddItem }: SuggestionListProps) {
const { isDark } = useTheme();

const itemsList = useMemo(() => {
if (!suggestion?.Items) {
return [];
}
return suggestion.Items;
return suggestion || [];
}, [suggestion]);

return (
Expand Down
Loading
Loading