Skip to content

Commit 87c1033

Browse files
committed
upate
1 parent dd1a460 commit 87c1033

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+228
-250
lines changed

hackathon/spacecraft/.eslintrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
"plugin:react/recommended", // React rules
1010
"plugin:react/jsx-runtime", // Support for React 17 JSX
1111
"plugin:prettier/recommended", // Prettier recommended rules
12+
"plugin:perfectionist/recommended-natural-legacy",
1213
],
1314
overrides: [
1415
{
@@ -30,18 +31,18 @@ module.exports = {
3031
camelcase: "off", // Disable camelcase rule
3132
"perfectionist/sort-imports": "error", // Perfectionist import sorting
3233
"perfectionist/sort-interfaces": ["error"], // Perfectionist interfaces sorting
33-
"perfectionist/sort-objects": ["error", { type: "alphabetical" }], // Perfectionist objects sorting
34+
"perfectionist/sort-objects": ["error", { type: "natural" }], // Perfectionist objects sorting
3435
"prettier/prettier": [
3536
"warn",
3637
{
3738
usePrettierrc: true,
3839
},
3940
],
41+
"react/no-unescaped-entities": "off",
4042
"react-native/no-color-literals": 2, // Enforce color literals are not used
4143
"react-native/no-raw-text": 0, // Detect raw text outside of Text component
4244
"react-native/no-unused-styles": 2, // Detect unused StyleSheet rules
4345
"react-native/sort-styles": 2, // Enforce style definitions are sorted
44-
"react/no-unescaped-entities": "off",
4546
},
4647
settings: {
4748
perfectionist: {

hackathon/spacecraft/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from "react";
1+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
22
import Constants from "expo-constants";
3+
34
import { Provider as PaperProvider } from "react-native-paper";
4-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
55

6-
import { Navigator } from "~/navigation/Navigator";
6+
import { AuthenticationProvider } from "~/context/Authentication";
77
import { NetworkProvider } from "~/context/Network";
88
import { useAppearanceTheme } from "~/hooks/useAppearanceTheme";
9-
import { AuthenticationProvider } from "~/context/Authentication";
9+
import { Navigator } from "~/navigation/Navigator";
1010

1111
const queryClient = new QueryClient();
1212

hackathon/spacecraft/api/types.d.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
export interface StarshipProps {
2-
films?: [];
3-
pilots?: [];
4-
name: string;
5-
url?: string;
6-
MGLT?: string;
2+
cargo_capacity?: string;
3+
consumables?: string;
4+
cost_in_credits?: string;
5+
created?: string;
76
crew?: string;
8-
model: string;
97
edited?: string;
8+
films?: [];
9+
hyperdrive_rating?: string;
1010
length?: string;
11-
created?: string;
12-
passengers?: string;
13-
consumables?: string;
1411
manufacturer?: string;
15-
cargo_capacity?: string;
16-
starship_class?: string;
17-
cost_in_credits?: string;
18-
hyperdrive_rating?: string;
1912
max_atmosphering_speed?: string;
13+
MGLT?: string;
14+
model: string;
15+
name: string;
16+
passengers?: string;
17+
pilots?: [];
18+
starship_class?: string;
19+
url?: string;
2020
}
2121

2222
interface PeopleProps {
23-
url: string;
24-
name: string;
25-
mass: string;
26-
height: string;
27-
gender: string;
28-
edited: string;
29-
films: string[];
23+
birth_year: string;
3024
created: string;
25+
edited: string;
3126
eye_color: string;
32-
homeworld: string;
33-
species: string[];
27+
films: string[];
28+
gender: string;
3429
hair_color: string;
30+
height: string;
31+
homeworld: string;
32+
mass: string;
33+
name: string;
3534
skin_color: string;
36-
birth_year: string;
37-
vehicles: string[];
35+
species: string[];
3836
starships: string[];
37+
url: string;
38+
vehicles: string[];
3939
}

hackathon/spacecraft/metro.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// metro.config.js
2-
const path = require("path");
3-
const { getDefaultConfig } = require("expo/metro-config");
42
const { generate } = require("@storybook/react-native/scripts/generate");
3+
const { getDefaultConfig } = require("expo/metro-config");
4+
const path = require("path");
55

66
generate({
77
configPath: path.resolve(__dirname, "./.storybook"),

hackathon/spacecraft/src/components/Button.stories.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,61 @@ export default {
88
export const _Button = () => (
99
<View style={{ flex: 1, justifyContent: "space-around", padding: 16 }}>
1010
<Button
11-
onPress={() => Alert.alert("Pressed!")}
1211
mode="contained"
12+
onPress={() => Alert.alert("Pressed!")}
1313
>
1414
contained
1515
</Button>
1616
<Button
17-
onPress={() => Alert.alert("Pressed!")}
1817
mode="contained-tonal"
18+
onPress={() => Alert.alert("Pressed!")}
1919
>
2020
contained-tonal
2121
</Button>
2222
<Button
23-
onPress={() => Alert.alert("Pressed!")}
2423
mode="elevated"
24+
onPress={() => Alert.alert("Pressed!")}
2525
>
2626
elevated
2727
</Button>
2828
<Button
29-
onPress={() => Alert.alert("Pressed!")}
3029
mode="outlined"
30+
onPress={() => Alert.alert("Pressed!")}
3131
>
3232
outlined
3333
</Button>
3434
<Button
35-
onPress={() => Alert.alert("Pressed!")}
3635
mode="text"
36+
onPress={() => Alert.alert("Pressed!")}
3737
>
3838
text
3939
</Button>
4040
<Button
41-
onPress={() => Alert.alert("Pressed!")}
42-
mode="text"
4341
icon="camera"
42+
mode="text"
43+
onPress={() => Alert.alert("Pressed!")}
4444
>
4545
<ActivityIndicator />
4646
text
4747
</Button>
4848
<Button
49-
onPress={() => Alert.alert("Pressed!")}
50-
mode="text"
5149
icon="arrow-u-up-left"
50+
mode="text"
51+
onPress={() => Alert.alert("Pressed!")}
5252
>
5353
text
5454
</Button>
5555
<Button
56-
onPress={() => Alert.alert("Pressed!")}
57-
mode="text"
5856
icon="backup-restore"
57+
mode="text"
58+
onPress={() => Alert.alert("Pressed!")}
5959
>
6060
text
6161
</Button>
6262
<Button
63-
onPress={() => Alert.alert("Pressed!")}
64-
mode="text"
6563
icon="battery-charging-medium"
64+
mode="text"
65+
onPress={() => Alert.alert("Pressed!")}
6666
>
6767
text
6868
</Button>
@@ -73,8 +73,8 @@ export const _ButtonSizes = () => (
7373
<View style={{ flex: 1, justifyContent: "space-around", padding: 16 }}>
7474
<Button onPress={() => Alert.alert("Pressed!")}>small</Button>
7575
<Button
76-
onPress={() => Alert.alert("Pressed!")}
7776
compact={true}
77+
onPress={() => Alert.alert("Pressed!")}
7878
>
7979
medium
8080
</Button>

hackathon/spacecraft/src/components/ButtonSupport.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from "react";
2-
import { Button } from "react-native-paper";
31
import * as WebBrowser from "expo-web-browser";
42

3+
import { Button } from "react-native-paper";
4+
55
interface Props {
66
mode?: "contained" | "text";
77
}
@@ -15,8 +15,8 @@ export const ButtonSupport = ({ mode = "contained" }: Props) => {
1515

1616
return (
1717
<Button
18-
onPress={handleOpenGitHub}
1918
mode={mode}
19+
onPress={handleOpenGitHub}
2020
style={{ marginBottom: 12 }}
2121
>
2222
Give my opinion

hackathon/spacecraft/src/components/FromInput.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import { fireEvent, render, screen } from "@testing-library/react-native";
32

43
import { FormInput } from "~/components/FromInput";
@@ -9,8 +8,8 @@ describe("FormInput", () => {
98
render(
109
<FormInput
1110
label="your-car"
12-
value="tesla"
1311
onChangeText={mock}
12+
value="tesla"
1413
/>,
1514
);
1615
screen.getAllByText("your-car");

hackathon/spacecraft/src/components/FromInput.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { TextInputProps } from "react-native-paper";
22

3-
import React from "react";
43
import { View } from "react-native";
54
import { TextInput } from "react-native-paper";
65

@@ -13,10 +12,10 @@ export const FormInput = ({
1312
<View style={{ paddingVertical: 8 }}>
1413
<TextInput
1514
{...rest}
16-
mode="outlined"
1715
label={label}
18-
value={value}
16+
mode="outlined"
1917
onChangeText={onChangeText}
18+
value={value}
2019
/>
2120
</View>
2221
);

hackathon/spacecraft/src/components/Header.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import { render, screen } from "@testing-library/react-native";
32

43
import { Header } from "./Header";

hackathon/spacecraft/src/components/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from "react";
21
import Constants from "expo-constants";
2+
33
import { StyleSheet, View } from "react-native";
44
import { Text, useTheme } from "react-native-paper";
55

@@ -13,8 +13,8 @@ export const Header = ({ title }: HeaderProps) => {
1313
return (
1414
<View style={[styles.container, { backgroundColor: theme.colors.primary }]}>
1515
<Text
16-
variant="headlineMedium"
1716
style={[styles.headerText, { color: theme.colors.background }]}
17+
variant="headlineMedium"
1818
>
1919
{title}
2020
</Text>

hackathon/spacecraft/src/components/Image.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import type { ImageProps } from "react-native";
33
import type { AnimatedProps } from "react-native-reanimated";
44

5-
import React from "react";
6-
import Animated from "react-native-reanimated";
7-
import { Image as RNImage } from "react-native";
85
import { Image as ExpoImage } from "expo-image";
96

7+
import { Image as RNImage } from "react-native";
8+
import Animated from "react-native-reanimated";
9+
1010
const AnimatedImage = Animated.createAnimatedComponent(RNImage);
1111

1212
export const Image = (props: AnimatedProps<ImageProps>) => {

hackathon/spacecraft/src/components/Offline.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import { StyleSheet, Text, View } from "react-native";
32
import { ActivityIndicator, useTheme } from "react-native-paper";
43

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { PeopleProps } from "api/types";
22

3-
import React from "react";
4-
import { List } from "react-native-paper";
53
import { useNavigation } from "@react-navigation/native";
64

5+
import { List } from "react-native-paper";
6+
77
import { Routes } from "~/navigation/Routes";
88

99
interface PeopleItemProps {
@@ -12,28 +12,28 @@ interface PeopleItemProps {
1212

1313
const GengerIcon = ({ gender, ...rest }: { gender: string }) => {
1414
switch (gender) {
15-
case "male":
15+
case "female":
1616
return (
1717
<List.Icon
1818
{...rest}
19-
icon="human-male"
20-
color="#3B82F6"
19+
color="#EC4899"
20+
icon="human-female"
2121
/>
2222
);
23-
case "female":
23+
case "male":
2424
return (
2525
<List.Icon
2626
{...rest}
27-
icon="human-female"
28-
color="#EC4899"
27+
color="#3B82F6"
28+
icon="human-male"
2929
/>
3030
);
3131
default:
3232
return (
3333
<List.Icon
3434
{...rest}
35-
icon="robot"
3635
color="#9CA3AF"
36+
icon="robot"
3737
/>
3838
);
3939
}
@@ -49,21 +49,21 @@ export const PeopleItem = ({ people }: PeopleItemProps) => {
4949

5050
return (
5151
<List.Item
52-
title={people.name}
5352
description={`${starships.length} starships`}
5453
left={(props) => (
5554
<GengerIcon
5655
{...props}
5756
gender={gender}
5857
/>
5958
)}
59+
onPress={navigateToDetails}
6060
right={(props) => (
6161
<List.Icon
6262
{...props}
6363
icon="dots-horizontal"
6464
/>
6565
)}
66-
onPress={navigateToDetails}
66+
title={people.name}
6767
/>
6868
);
6969
};

0 commit comments

Comments
 (0)