Skip to content

Commit

Permalink
(chore) Bump version + Type dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaHaceCosas committed Jan 26, 2025
1 parent 303e1b8 commit 313f00b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 58 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes will be documented in this file.

The format is <!--mostly--> based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Dates use the DD-MM-YYYY format.

## Unreleased
## [0.0.6-preapp.29] - Unreleased

### Added

Expand Down
2 changes: 1 addition & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const config: ExpoConfig.ExpoConfig = {
"android.permission.WAKE_LOCK",
"android.permission.ACCESS_FINE_LOCATION",
],
versionCode: 28,
versionCode: 29,
backgroundColor: "#0E1013",
},
ios: {
Expand Down
113 changes: 58 additions & 55 deletions app/(tabs)/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function Dashboard(): ReactElement {
>(null);
const [loading, setLoading] = useState<boolean>(true);

useEffect(() => {
useEffect((): void => {
async function handler(): Promise<void> {
try {
const objectives: ActiveObjective[] | null =
Expand All @@ -58,21 +58,22 @@ export default function Dashboard(): ReactElement {
handler();
}, []);

const handleObjective = async (
async function handleObjective(
identifier: number,
action: "delete" | "edit",
) => {
): Promise<void> {
try {
if (action === "delete") {
await DeleteActiveObjective(identifier);
// update & redraw without re-fetching everything upon update.
setActiveObjectives(
activeObjectives?.filter(
(obj) => obj.identifier !== identifier,
(obj: ActiveObjective): boolean =>
obj.identifier !== identifier,
) || null,
);
return;
} else {
} else if (action === "edit") {
const obj: ActiveObjective | null =
await GetActiveObjective(identifier);
if (!obj) {
Expand All @@ -96,7 +97,7 @@ export default function Dashboard(): ReactElement {
"error",
);
}
};
}

if (loading) return <Loading />;

Expand All @@ -113,55 +114,57 @@ export default function Dashboard(): ReactElement {
header={t("activeObjectives.noObjectives.noObjectives")}
/>
) : (
activeObjectives.map((obj: ActiveObjective) => {
return (
<Division
key={obj.identifier}
header={t(
`globals.supportedActiveObjectives.${obj.exercise}.name`,
)}
preHeader={t(
"activeObjectives.allCapsSingular",
)}
direction="vertical"
>
<ObjectiveDescriptiveIcons obj={obj} />
<View style={styles.divButtons}>
<BetterButton
style="WOR"
buttonText={t(
"pages.dashboard.deleteObjective.text",
)}
buttonHint={t(
"pages.dashboard.deleteObjective.hint",
)}
action={() =>
handleObjective(
obj.identifier,
"delete",
)
}
/>
<GapView width={10} />
<BetterButton
style="ACE"
buttonText={t(
"pages.dashboard.editObjective.text",
)}
buttonHint={t(
"pages.dashboard.editObjective.hint",
)}
action={() =>
handleObjective(
obj.identifier,
"edit",
)
}
/>
</View>
</Division>
);
})
activeObjectives.map(
(obj: ActiveObjective): ReactElement => {
return (
<Division
key={obj.identifier}
header={t(
`globals.supportedActiveObjectives.${obj.exercise}.name`,
)}
preHeader={t(
"activeObjectives.allCapsSingular",
)}
direction="vertical"
>
<ObjectiveDescriptiveIcons obj={obj} />
<View style={styles.divButtons}>
<BetterButton
style="WOR"
buttonText={t(
"pages.dashboard.deleteObjective.text",
)}
buttonHint={t(
"pages.dashboard.deleteObjective.hint",
)}
action={async (): Promise<void> =>
await handleObjective(
obj.identifier,
"delete",
)
}
/>
<GapView width={10} />
<BetterButton
style="ACE"
buttonText={t(
"pages.dashboard.editObjective.text",
)}
buttonHint={t(
"pages.dashboard.editObjective.hint",
)}
action={async (): Promise<void> =>
await handleObjective(
obj.identifier,
"edit",
)
}
/>
</View>
</Division>
);
},
)
)}
<View style={styles.buttonWrapper}>
<BetterButton
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "personaplus",
"main": "expo-router/entry",
"version": "0.0.6-preapp.28",
"version": "0.0.6-preapp.29",
"scripts": {
"start": "expo start --go",
"start:clear": "expo start --go --clear",
Expand Down

0 comments on commit 313f00b

Please sign in to comment.