Skip to content

Commit

Permalink
swipeable walkthrough, custom units
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCoderSJ committed Aug 14, 2024
1 parent 09fb002 commit 7e1de13
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 52 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build App
on:
workflow_dispatch:
inputs:
os:
type: choice
description: OS to build on. Ubuntu is faster, MacOS supports iOS builds, Windows is unsupported
options:
- macos-latest
- ubuntu-latest
platform:
type: choice
description: Platform to build for
options:
- android
- ios
profile:
type: choice
description: Build profile to use
options:
- development
- preview
- production
jobs:
build:
environment: workflow-build
runs-on: ${{ github.event.inputs.os }}
strategy:
matrix:
node: [18.x]
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v2

- name: 🏗 Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: yarn

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '17'

- name: 🏗 Setup Expo and EAS
uses: expo/expo-github-action@v7
with:
token: ${{ vars.EXPO_TOKEN }}
expo-version: latest
eas-version: latest

- name: 🏗 Setup EAS local builds
run: yarn global add eas-cli-local-build-plugin

- name: 📦 Install dependencies
run: yarn

- name: Patch packages
run: yarn add patch-package && yarn patch-package

- name: 👷 Build app
run: |
eas build --local \
--non-interactive \
--output=./app-build \
--platform=${{ github.event.inputs.platform }} \
--profile=${{ github.event.inputs.profile }}
- name: 📱 Upload binary
uses: actions/upload-artifact@v4
with:
name: app-${{ github.event.inputs.platform }}
path: app-build

File renamed without changes.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "minichef",
"slug": "minichef",
"version": "1.1.1",
"version": "1.1.2",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minichef",
"version": "1.0.0",
"version": "1.1.2",
"main": "expo/AppEntry.js",
"scripts": {
"start": "expo start",
Expand Down Expand Up @@ -33,6 +33,7 @@
"react-native": "0.74.2",
"react-native-appwrite": "^0.4.0",
"react-native-autocomplete-dropdown": "^3.1.5",
"react-native-deck-swiper": "^2.0.17",
"react-native-dialog": "^9.3.0",
"react-native-gesture-handler": "~2.16.1",
"react-native-image-picker": "^7.1.2",
Expand Down
25 changes: 24 additions & 1 deletion screens/recipe/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Client, Databases, Query, Permission, Role, ID, Storage } from "react-n
import Autocomplete from '../../components/autocomplete';
import SlidePicker from "react-native-slidepicker";
import {launchImageLibrary} from 'react-native-image-picker';
import Dialog from "react-native-dialog";

const client = new Client()
.setEndpoint('https://appwrite.shuchir.dev/v1') // Your API Endpoint
Expand All @@ -39,6 +40,7 @@ let recipe = {
};

let unitBeingEdited = null;
let customUnit = "";

let sliderData = [
[
Expand Down Expand Up @@ -98,6 +100,10 @@ let sliderData = [
"label": "Pinch",
"value": "pinch"
},
{
"label": "Custom Unit",
"value": "custom"
}
],
]
let stage = 1;
Expand All @@ -116,6 +122,7 @@ export default function CreateRecipe () {
const [steps, setSteps] = React.useState([{}]);
const [filterList, setFilterList] = React.useState([{}]);
const [sliderVisible, setSliderVisible] = React.useState(false);
const [customVisible, setCustomVisible] = React.useState(false);
const { height: screenHeight } = Dimensions.get('window');


Expand Down Expand Up @@ -677,6 +684,18 @@ export default function CreateRecipe () {

</View>
</ScrollView>

<Dialog.Container visible={customVisible}>
<Dialog.Title>Enter Custom Unit</Dialog.Title>
<Dialog.Input placeholder="enter custom unit here..." onChangeText={res => {customUnit = res; console.log(res)}} />
<Dialog.Button label="Cancel" onPress={() => setCustomVisible(false)} />
<Dialog.Button label="Save" onPress={() => {
console.log(customUnit)
handleChange(unitBeingEdited, "serving_unit", customUnit)
setCustomVisible(false)
forceUpdate();
}} />
</Dialog.Container>

<SlidePicker.Parallel
visible={sliderVisible}
Expand All @@ -688,7 +707,11 @@ export default function CreateRecipe () {
onCancelClick={() => setSliderVisible(false)}
onConfirmClick={res => {
console.log(res)
handleChange(unitBeingEdited, "serving_unit", res[0].value)
if (res[0].value != "custom") handleChange(unitBeingEdited, "serving_unit", res[0].value)
else {
customUnit = "";
setCustomVisible(true)
}
setSliderVisible(false)
forceUpdate();
}}
Expand Down
32 changes: 30 additions & 2 deletions screens/recipe/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Client, Databases, Query, Permission, Role, Storage, ID } from "react-n
import Autocomplete from '../../components/autocomplete';
import SlidePicker from "react-native-slidepicker";
import { launchImageLibrary } from 'react-native-image-picker';
import Dialog from "react-native-dialog";

const client = new Client()
.setEndpoint('https://appwrite.shuchir.dev/v1') // Your API Endpoint
Expand All @@ -33,6 +34,7 @@ let imgNames = [];
let stage = 1;

let unitBeingEdited = null;
let customUnit = "";

let sliderData = [
[
Expand Down Expand Up @@ -92,6 +94,10 @@ let sliderData = [
"label": "Pinch",
"value": "pinch"
},
{
"label": "Custom Unit",
"value": "custom"
}
],
]

Expand Down Expand Up @@ -133,6 +139,7 @@ export default function EditRecipe ({ navigation, route }) {
const [steps, setSteps] = React.useState([{}]);
const [filterList, setFilterList] = React.useState([{}]);
const [sliderVisible, setSliderVisible] = React.useState(false);
const [customVisible, setCustomVisible] = React.useState(false);

React.useEffect(() => {
stage = 1;
Expand Down Expand Up @@ -388,11 +395,15 @@ export default function EditRecipe ({ navigation, route }) {
}
}

while ((recipe.image != "" && data['imageId'] == undefined) || countOccurrences(data.stepImages, "") > countOccurrences(recipe.stepImages, "")) {
console.log(countOccurrences(data.stepImages, ""), countOccurrences(recipe.stepImages, ""))
console.log(recipe.image, data.imageId)
console.log(data)
while ((recipe.image && data['imageId'] == undefined) || countOccurrences(data.stepImages, "") > countOccurrences(recipe.stepImages, "")) {
await new Promise(r => setTimeout(r, 500));
}

try {
console.log("CREATING")
await db.createDocument("data", "recipes", recipe.recipeId, data, [
Permission.read(Role.user(userId)),
Permission.write(Role.user(userId)),
Expand All @@ -407,6 +418,7 @@ export default function EditRecipe ({ navigation, route }) {
}

catch {
console.log("UPDATING")
await db.updateDocument("data", "recipes", recipe.recipeId, data, [
Permission.read(Role.user(userId)),
Permission.write(Role.user(userId)),
Expand Down Expand Up @@ -775,6 +787,18 @@ export default function EditRecipe ({ navigation, route }) {

</ScrollView>

<Dialog.Container visible={customVisible}>
<Dialog.Title>Enter Custom Unit</Dialog.Title>
<Dialog.Input placeholder="enter custom unit here..." onChangeText={res => {customUnit = res; console.log(res)}} />
<Dialog.Button label="Cancel" onPress={() => setCustomVisible(false)} />
<Dialog.Button label="Save" onPress={() => {
console.log(customUnit)
handleChange(unitBeingEdited, "serving_unit", customUnit)
setCustomVisible(false)
forceUpdate();
}} />
</Dialog.Container>

<SlidePicker.Parallel
visible={sliderVisible}
dataSource={sliderData}
Expand All @@ -785,7 +809,11 @@ export default function EditRecipe ({ navigation, route }) {
onCancelClick={() => setSliderVisible(false)}
onConfirmClick={res => {
console.log(res)
handleChange(unitBeingEdited, "serving_unit", res[0].value)
if (res[0].value != "custom") handleChange(unitBeingEdited, "serving_unit", res[0].value)
else {
customUnit = "";
setCustomVisible(true)
}
setSliderVisible(false)
forceUpdate();
}}
Expand Down
Loading

0 comments on commit 7e1de13

Please sign in to comment.