Skip to content

Commit

Permalink
Merge branch 'andrew_testing' into fix/googleSignIn
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bierman authored Apr 28, 2024
2 parents f27c443 + 8183d40 commit 642b7a3
Show file tree
Hide file tree
Showing 36 changed files with 1,716 additions and 216 deletions.
41 changes: 41 additions & 0 deletions .github/actions/setup-eas/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Setup EAS'
description: 'Set up EAS and install dependencies'

inputs:
expo-token:
description: 'Expo token for authentication'
required: true
node-version:
description: 'Node.js version to use'
required: true
default: '20.x'

runs:
using: 'composite'
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ inputs.expo-token }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
shell: bash

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: yarn

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ inputs.expo-token }}

- name: Install dependencies
run: yarn install
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/eas-build-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: EAS Build Manual

on:
workflow_dispatch:
inputs:
platform:
description: 'Platform (android or ios)'
required: true
default: 'android'
type: choice
options:
- android
- ios
build-type:
description: 'Build type (preview or local)'
required: true
default: 'preview'
type: choice
options:
- preview
- local

jobs:
update:
name: EAS ${{ github.event.inputs.platform }} ${{ github.event.inputs.build-type }} Build
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Setup EAS
uses: ./.github/actions/setup-eas
with:
expo-token: ${{ secrets.EXPO_TOKEN }}
node-version: '20.x'

- name: Create build
uses: expo/expo-github-action/preview@v8
with:
working-directory: apps/expo
command: |
eas build --platform ${{ github.event.inputs.platform }} --profile preview \
${{ github.event.inputs.build-type == 'local' && '--local' || '' }}
8 changes: 7 additions & 1 deletion packages/app/components/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const SearchInput = forwardRef<TextInput, SearchInputProps>(
handleSearchChange,
showSearchResults,
isLoadingMobile,
isVisible,
} = useSearchInput({ onSelect, onChange, searchString });

const { currentTheme } = useTheme();
Expand Down Expand Up @@ -95,7 +96,12 @@ export const SearchInput = forwardRef<TextInput, SearchInputProps>(
)}
</RStack>

<RStack style={{ position: 'relative' }}>
<RStack
style={{
position: 'relative',
display: isVisible ? 'block' : 'none',
}}
>
{showSearchResults && results && results?.length > 0 && (
<RScrollView
position="absolute"
Expand Down
6 changes: 6 additions & 0 deletions packages/app/components/SearchInput/useSearchInput.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import { set } from 'lodash';
import { useState } from 'react';

const useSearchInput = ({ onSelect, onChange, searchString }) => {
const [isLoadingMobile, setIsLoadingMobile] = useState(false);
const showSearchResults = !!searchString;
const [isVisible, setIsVisible] = useState(false);

const handleSearchResultClick = (result) => {
if (onSelect) {
const newSearchValue = onSelect(result);
onChange(newSearchValue);
setIsVisible(false);
}
};

const handleClearSearch = () => {
onChange('');
setIsVisible(false);
};

const handleSearchChange = (text) => {
onChange(text);
setIsVisible(true);
};

return {
Expand All @@ -26,6 +31,7 @@ const useSearchInput = ({ onSelect, onChange, searchString }) => {
handleClearSearch,
handleSearchChange,
isLoadingMobile,
isVisible,
};
};

Expand Down
60 changes: 52 additions & 8 deletions packages/app/components/card/PackCardHeader/PackCardHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import React from 'react';

import useTheme from 'app/hooks/useTheme';
import { CustomCardHeader } from '../CustomCardHeader';
import { AntDesign } from '@expo/vector-icons';
import { useAuthUser } from 'app/auth/hooks';
import { ThreeDotsMenu, YStack, RButton, EditableText } from '@packrat/ui';
import {
ThreeDotsMenu,
YStack,
RButton,
EditableText,
RIconButton,
RStack,
} from '@packrat/ui';
import { useDeletePack, useFetchSinglePack } from 'app/hooks/packs';
import { usePackTitleInput } from './usePackTitleInput';
import { useRouter } from 'app/hooks/router';
import { useEditPack } from 'app/hooks/packs/useEditPack';

interface PackCardHeaderProps {
data: any;
Expand All @@ -19,23 +29,57 @@ export const PackCardHeader = ({ data, title, link }: PackCardHeaderProps) => {
const { handleActionsOpenChange, handleEdit, handleSaveTitle, isEditMode } =
usePackTitleInput(data);

const { currentTheme } = useTheme();
const router = useRouter();
const { editPack } = useEditPack();

const handleSavePack = () => {
const packDetails = {
id: data.id,
name: data.name,
is_public: data.is_public,
};
editPack(packDetails);
}
return (
<CustomCardHeader
data={data}
title={
<EditableText
isLoading={isLoading}
defaultValue={title}
isFocused={isEditMode}
onSave={handleSaveTitle}
/>
<RStack
style={{
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
}}
>
<RIconButton
backgroundColor="transparent"
icon={
<AntDesign
name="arrowleft"
size={24}
color={currentTheme.colors.black}
/>
}
onPress={()=>{
router.back();
}}
/>
<EditableText
isLoading={isLoading}
defaultValue={title}
isFocused={isEditMode}
onSave={handleSaveTitle}
/>
</RStack>
}
link={link}
actionsComponent={
user?.id === data.owner_id && (
<ThreeDotsMenu onOpenChange={handleActionsOpenChange}>
<YStack space="$1">
<RButton onPress={handleEdit}>Edit</RButton>
<RButton onPress={handleSavePack}>Save</RButton>
<RButton onPress={handleDeletePack}>Delete</RButton>
</YStack>
</ThreeDotsMenu>
Expand Down
35 changes: 33 additions & 2 deletions packages/app/components/card/TripCardHeader/TripCardHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
import React from 'react';

import {Text} from "react-native";
import { useRouter } from 'app/hooks/router';
import useTheme from 'app/hooks/useTheme';
import { CustomCardHeader } from '../CustomCardHeader';
import { RIconButton, RStack } from '@packrat/ui';
import { AntDesign } from '@expo/vector-icons';

export const TripCardHeader = ({ data, title, link }) => {

const { currentTheme } = useTheme();
const router = useRouter();

return (
<CustomCardHeader
data={data}
title={title}
title={<RStack
style={{
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
}}
>
<RIconButton
backgroundColor="transparent"
icon={
<AntDesign
name="arrowleft"
size={24}
color={currentTheme.colors.black}
/>
}
onPress={()=>{
router.back();
}}
/>
<Text>
{title}
</Text>
</RStack>}
link={link}
actionsComponent={undefined}
/>
Expand Down
Loading

0 comments on commit 642b7a3

Please sign in to comment.