From 37f494402927157ead1be100a612e955e6cbc11a Mon Sep 17 00:00:00 2001 From: shahzaib Date: Mon, 10 Jun 2024 12:33:00 +0500 Subject: [PATCH 001/257] :Ui fixes --- .../components/card/PackCardHeader/PackCardHeader.tsx | 4 +++- packages/app/components/pack/PackDetails.tsx | 6 ++++-- packages/app/screens/user/Settings.tsx | 1 + packages/ui/src/RSelect/index.tsx | 3 ++- packages/ui/src/dialog/BaseDialog.tsx | 9 +++++---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/app/components/card/PackCardHeader/PackCardHeader.tsx b/packages/app/components/card/PackCardHeader/PackCardHeader.tsx index 66c067dac..9241dfb93 100644 --- a/packages/app/components/card/PackCardHeader/PackCardHeader.tsx +++ b/packages/app/components/card/PackCardHeader/PackCardHeader.tsx @@ -34,6 +34,7 @@ export const PackCardHeader = ({ data, title }: PackCardHeaderProps) => { usePackTitleInput(data); const { isDark, currentTheme } = useTheme(); + const router = useRouter(); const { editPack } = useEditPack(); @@ -48,6 +49,7 @@ export const PackCardHeader = ({ data, title }: PackCardHeaderProps) => { return ( <> { } actionsComponent={ user?.id === data.owner_id && ( - + Edit Save diff --git a/packages/app/components/pack/PackDetails.tsx b/packages/app/components/pack/PackDetails.tsx index d0637eac4..90e87c44b 100644 --- a/packages/app/components/pack/PackDetails.tsx +++ b/packages/app/components/pack/PackDetails.tsx @@ -66,7 +66,7 @@ export function PackDetails() { if (isLoading) return Loading...; return ( - <> + - + ); } diff --git a/packages/app/screens/user/Settings.tsx b/packages/app/screens/user/Settings.tsx index 2f88aa0e3..fe997d614 100644 --- a/packages/app/screens/user/Settings.tsx +++ b/packages/app/screens/user/Settings.tsx @@ -50,6 +50,7 @@ export default function Settings() { paddingVertical={20} paddingHorizontal={8} marginHorizontal="auto" + marginVertical={40} > No options available; + return No options available; } return ( diff --git a/packages/ui/src/dialog/BaseDialog.tsx b/packages/ui/src/dialog/BaseDialog.tsx index 245b407af..924da238c 100644 --- a/packages/ui/src/dialog/BaseDialog.tsx +++ b/packages/ui/src/dialog/BaseDialog.tsx @@ -38,7 +38,7 @@ export const BaseDialog = ({ - + @@ -74,9 +74,10 @@ export const BaseDialog = ({ exitStyle={{ x: 0, y: 10, opacity: 0, scale: 0.95 }} gap="$4" > - {title} - - {description} + {title && {title}} + {description && ( + {description} + )} {children} From fc71966f941376c00e1cfcc9a045c54310af7338 Mon Sep 17 00:00:00 2001 From: Anmol Verma Date: Sat, 8 Jun 2024 17:37:20 +0530 Subject: [PATCH 002/257] Change width according to screen size --- packages/app/components/dashboard/HeroBanner.tsx | 13 ++++++++----- .../app/components/dashboard/QuickActionButton.tsx | 6 ++++++ .../app/components/dashboard/QuickActionSection.tsx | 3 +++ packages/app/components/dashboard/Section.tsx | 3 +++ packages/app/components/feed/FeedSearchFilter.tsx | 9 +++++++-- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/packages/app/components/dashboard/HeroBanner.tsx b/packages/app/components/dashboard/HeroBanner.tsx index fe796cbdb..e040cdfe5 100644 --- a/packages/app/components/dashboard/HeroBanner.tsx +++ b/packages/app/components/dashboard/HeroBanner.tsx @@ -12,6 +12,7 @@ import { first } from 'lodash'; import { hexToRGBA } from '../../utils/colorFunctions'; import useCustomStyles from 'app/hooks/useCustomStyles'; import { PlacesAutocomplete } from 'app/components/PlacesAutocomplete/PlacesAutocomplete'; +import { useScreenWidth } from 'app/hooks/common'; const RText: any = OriginalRText; interface HeroSectionProps { @@ -72,6 +73,8 @@ const HeroSection: React.FC = ({ onSelect }) => { ? `Let's find a new trail, ${firstNameOrUser}` : "Let's find a new trail"; + const { screenWidth } = useScreenWidth(); + return ( = ({ onSelect }) => { cardBackgroundColor || currentTheme.colors.secondaryBlue, alignItems: 'center', justifyContent: 'center', - width: '100%', - height: '100%', + width: screenWidth <= 425 ? '80vw' :'30vw', + height:'30vh', padding: 50, }} title={''} @@ -100,8 +103,8 @@ const HeroSection: React.FC = ({ onSelect }) => { > { marginTop: 20, alignItems: 'center', justifyContent: 'center', - width: '100%', + width: '60vw', position: 'relative', zIndex: 1, }, diff --git a/packages/app/components/dashboard/QuickActionButton.tsx b/packages/app/components/dashboard/QuickActionButton.tsx index c5c334378..e9b762e23 100644 --- a/packages/app/components/dashboard/QuickActionButton.tsx +++ b/packages/app/components/dashboard/QuickActionButton.tsx @@ -4,6 +4,7 @@ import { MaterialIcons } from '@expo/vector-icons'; import React from 'react'; import { theme } from '../../theme'; import useCustomStyles from 'app/hooks/useCustomStyles'; +import { useScreenWidth } from 'app/hooks/common'; const RCard: any = OriginalRCard; @@ -38,14 +39,19 @@ const QuickActionButton = ({ const loadStyles = (theme: any) => { const { currentTheme } = theme; + const {screenWidth} = useScreenWidth(); return { container: { margin: 10, + width: screenWidth <= 425 ? '15vw':'10vw', + height:'10vh', }, card: { flexDirection: 'column', justifyContent: 'center', alignItems: 'center', + width: screenWidth <= 425 ? '15vw':'10vw', + height:'10vh', // paddingHorizontal: 40, // paddingVertical: 60, backgroundColor: currentTheme.colors.primary, diff --git a/packages/app/components/dashboard/QuickActionSection.tsx b/packages/app/components/dashboard/QuickActionSection.tsx index 5c11f1768..6798dda26 100644 --- a/packages/app/components/dashboard/QuickActionSection.tsx +++ b/packages/app/components/dashboard/QuickActionSection.tsx @@ -2,6 +2,7 @@ import { RStack } from '@packrat/ui'; import QuickActionButton from './QuickActionButton'; import useCustomStyles from 'app/hooks/useCustomStyles'; import { useQuickActions } from 'app/hooks/dashboard'; +import { useScreenWidth } from 'app/hooks/common'; const QuickActionsSection = () => { const styles = useCustomStyles(loadStyles); @@ -25,10 +26,12 @@ const QuickActionsSection = () => { const loadStyles = (theme) => { const { currentTheme } = theme; + const {screenWidth} = useScreenWidth(); return { section: { marginBottom: 20, paddingHorizontal: 20, // Added padding here. + width : screenWidth <= 425 ? '40vw' : '23vw', }, card: { justifyContent: 'center', diff --git a/packages/app/components/dashboard/Section.tsx b/packages/app/components/dashboard/Section.tsx index 8fdd36499..b10ca90a7 100644 --- a/packages/app/components/dashboard/Section.tsx +++ b/packages/app/components/dashboard/Section.tsx @@ -3,6 +3,7 @@ import { RCard } from '@packrat/ui'; import React from 'react'; import useCustomStyles from 'app/hooks/useCustomStyles'; import { TouchableOpacity } from 'react-native'; +import { useScreenWidth } from 'app/hooks/common'; interface SectionProps { children: React.ReactNode; @@ -23,6 +24,7 @@ const Section: React.FC = ({ children, onPress }) => { const loadStyles = (theme: any) => { const { currentTheme } = theme; + const {screenWidth} = useScreenWidth(); return { section: { marginBottom: 20, @@ -31,6 +33,7 @@ const loadStyles = (theme: any) => { card: { justifyContent: 'center', alignItems: 'center', + width:screenWidth <= 425 ?'40vw' :'55vw', paddingHorizontal: 10, paddingVertical: 20, backgroundColor: currentTheme.colors.secondaryBlue, diff --git a/packages/app/components/feed/FeedSearchFilter.tsx b/packages/app/components/feed/FeedSearchFilter.tsx index 5577cbe48..8a37839ea 100644 --- a/packages/app/components/feed/FeedSearchFilter.tsx +++ b/packages/app/components/feed/FeedSearchFilter.tsx @@ -16,6 +16,7 @@ import { import { AntDesign } from '@expo/vector-icons'; import DropdownComponent from 'app/components/Dropdown'; import Layout from 'app/components/layout/Layout'; +import { useScreenWidth } from 'app/hooks/common'; const RStack: any = OriginalRStack; const RText: any = OriginalRText; const RSeparator: any = OriginalRSeparator; @@ -60,6 +61,7 @@ const FeedSearchFilter = ({ const [searchValue, setSearchValue] = useState(''); const onSearch = (search) => setSearchQuery(search); + const {screenWidth} = useScreenWidth(); return ( @@ -71,6 +73,7 @@ const FeedSearchFilter = ({ style={{ flexDirection: 'row', justifyContent: 'center' }} > {(feedType === 'userPacks' || feedType === 'userTrips') && ( @@ -182,7 +185,9 @@ const FeedSearchFilter = ({ const loadStyles = (theme: any) => { const { currentTheme } = theme; + return { + mainContainer: { flex: 1, backgroundColor: currentTheme.colors.background, @@ -193,7 +198,7 @@ const loadStyles = (theme: any) => { backgroundColor: currentTheme.colors.card, padding: 15, fontSize: 18, - width: '100%', + width: '60vw', borderRadius: 10, marginTop: Platform.OS !== 'web' ? 20 : 0, }, From 934700cd17e15f2459edbd59cfa28eaeb0b095fc Mon Sep 17 00:00:00 2001 From: mikeCyb Date: Sat, 8 Jun 2024 08:28:54 +0300 Subject: [PATCH 003/257] Edit/ delete column removed in global items --- .../app/components/itemtable/itemTable.tsx | 45 ------------------- packages/app/tsconfig.json | 1 + 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/packages/app/components/itemtable/itemTable.tsx b/packages/app/components/itemtable/itemTable.tsx index 6618740c6..4ed9a0699 100644 --- a/packages/app/components/itemtable/itemTable.tsx +++ b/packages/app/components/itemtable/itemTable.tsx @@ -88,49 +88,6 @@ export const ItemsTable = ({ {category?.name || type} , - authUser && authUser.id === ownerId ? ( - - } - > - - - ) : ( - '' - ), - authUser && authUser.id === ownerId ? ( - { - handleDeleteItem(id, closeModal); - }} - triggerComponent={ - ( - - ) as any - } - /> - ) : ( - '' - ), ]; return ( ( Date: Sat, 8 Jun 2024 08:57:22 +0300 Subject: [PATCH 004/257] Edit/ delete column removed in global items --- packages/app/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json index 789f04999..ecbab72b1 100644 --- a/packages/app/tsconfig.json +++ b/packages/app/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "@tsconfig/react-native/tsconfig.json", "compilerOptions": { - "jsx": "react", "target": "ES2020", "module": "ESNext", "lib": [ From 8665b78a11fe3b1e4ca0c5e233cabff147bf3b02 Mon Sep 17 00:00:00 2001 From: shahzaib Date: Mon, 10 Jun 2024 13:31:37 +0500 Subject: [PATCH 005/257] : Modal close --- .../card/PackCardHeader/PackCardHeader.tsx | 15 ++++++++++----- .../card/PackCardHeader/usePackTitleInput.ts | 8 ++++++-- packages/app/hooks/packs/useDeletePack.ts | 2 +- packages/ui/src/ThreeDotsMenu/ThreeDotsMenu.tsx | 6 +++++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/app/components/card/PackCardHeader/PackCardHeader.tsx b/packages/app/components/card/PackCardHeader/PackCardHeader.tsx index 9241dfb93..3d231b787 100644 --- a/packages/app/components/card/PackCardHeader/PackCardHeader.tsx +++ b/packages/app/components/card/PackCardHeader/PackCardHeader.tsx @@ -19,6 +19,7 @@ import { useRouter } from 'app/hooks/router'; import { useEditPack } from 'app/hooks/packs/useEditPack'; import { Platform } from 'react-native'; import { CopyPackModal } from '../../pack/CopyPackModal'; +import { set } from 'lodash'; interface PackCardHeaderProps { data: any; @@ -29,21 +30,25 @@ interface PackCardHeaderProps { export const PackCardHeader = ({ data, title }: PackCardHeaderProps) => { const { isLoading, refetch } = useFetchSinglePack(data?.id); const user = useAuthUser(); - const handleDeletePack = useDeletePack(data.id); - const { handleActionsOpenChange, handleEdit, handleSaveTitle, isEditMode } = + const {handleDeletePack} = useDeletePack(data.id); + const { handleActionsOpenChange, handleEdit, handleSaveTitle, isEditMode,isOpen,setIsOpen } = usePackTitleInput(data); const { isDark, currentTheme } = useTheme(); const router = useRouter(); const { editPack } = useEditPack(); - +const handleDelete = () => { + handleDeletePack(); + setIsOpen(false); + } const handleSavePack = () => { const packDetails = { id: data.id, name: data.name, is_public: data.is_public, }; + setIsOpen(false); editPack(packDetails); }; return ( @@ -88,11 +93,11 @@ export const PackCardHeader = ({ data, title }: PackCardHeaderProps) => { } actionsComponent={ user?.id === data.owner_id && ( - + Edit Save - Delete + Delete ) diff --git a/packages/app/components/card/PackCardHeader/usePackTitleInput.ts b/packages/app/components/card/PackCardHeader/usePackTitleInput.ts index 9c954211e..7d148c1cb 100644 --- a/packages/app/components/card/PackCardHeader/usePackTitleInput.ts +++ b/packages/app/components/card/PackCardHeader/usePackTitleInput.ts @@ -4,17 +4,21 @@ import { useRef, useState } from 'react'; export const usePackTitleInput = (data) => { const [isEditMode, setIsEditMode] = useState(false); const isEditModeRef = useRef(false); + const [isOpen, setIsOpen] = useState(false); const { editPack } = useEditPack(); const handleActionsOpenChange = (state) => { + setIsOpen(true); if (!state && isEditModeRef.current) { isEditModeRef.current = false; setIsEditMode(true); + setIsOpen(true); } }; const handleEdit = () => { isEditModeRef.current = true; + setIsOpen(false) }; const handleSaveTitle = (title) => { @@ -23,10 +27,10 @@ export const usePackTitleInput = (data) => { name: title, is_public: data.is_public, }; - + setIsOpen(false); editPack(packDetails); setIsEditMode(false); }; - return { handleActionsOpenChange, isEditMode, handleEdit, handleSaveTitle }; + return { handleActionsOpenChange, isEditMode, handleEdit, handleSaveTitle,isOpen,setIsOpen }; }; diff --git a/packages/app/hooks/packs/useDeletePack.ts b/packages/app/hooks/packs/useDeletePack.ts index c3f0c17ff..331c066ba 100644 --- a/packages/app/hooks/packs/useDeletePack.ts +++ b/packages/app/hooks/packs/useDeletePack.ts @@ -12,5 +12,5 @@ export const useDeletePack = (id) => { } catch {} }; - return handleDeletePack; + return {handleDeletePack}; }; diff --git a/packages/ui/src/ThreeDotsMenu/ThreeDotsMenu.tsx b/packages/ui/src/ThreeDotsMenu/ThreeDotsMenu.tsx index 9be99fa2b..227f27e5f 100644 --- a/packages/ui/src/ThreeDotsMenu/ThreeDotsMenu.tsx +++ b/packages/ui/src/ThreeDotsMenu/ThreeDotsMenu.tsx @@ -8,16 +8,20 @@ const Popover: any = OriginalPopover; interface ThreeDotsMenuProps { children: ReactNode; onOpenChange: (open: boolean) => void; + open: boolean; } -export function ThreeDotsMenu({ children, onOpenChange }: ThreeDotsMenuProps) { +export function ThreeDotsMenu({ children, onOpenChange,open }: ThreeDotsMenuProps) { + console.log("ksksksks",open) return (