Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sakul-budhathoki committed Jul 23, 2023
1 parent 30d82e4 commit 064af2e
Show file tree
Hide file tree
Showing 53 changed files with 139 additions and 375 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: make validate-networks

- name: Build web app
run: yarn expo build:web
run: yarn expo export:web

- name: Check that there is no diff
run: git diff --exit-code
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ npx expo-electron start
### Build web app

```
npx expo-optimize && npx expo build:web
npx expo-optimize && npx expo export:web
```

The site is in `web-build/`
Expand Down
2 changes: 1 addition & 1 deletion declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare module "*.svg" {
const content: React.FC<SvgProps>;
export default content;
}

declare module "*.png" {
const value: any;

Expand Down
2 changes: 1 addition & 1 deletion modules/weshd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {

// Import the native module. On web, it will be resolved to Weshd.web.ts
// and on native platforms to Weshd.ts
import { ChangeEventPayload, WeshdViewProps } from "./src/Weshd.types";
import WeshdModule from "./src/WeshdModule";
import WeshdView from "./src/WeshdView";
import { ChangeEventPayload, WeshdViewProps } from "./src/Weshd.types";

// Get the native constant value.
export const PI = WeshdModule.PI;
Expand Down
4 changes: 2 additions & 2 deletions modules/weshd/src/WeshdModule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { requireNativeModule } from 'expo-modules-core';
import { requireNativeModule } from "expo-modules-core";

// It loads the native module object from the JSI or falls back to
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
export default requireNativeModule('Weshd');
export default requireNativeModule("Weshd");
6 changes: 3 additions & 3 deletions modules/weshd/src/WeshdModule.web.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { EventEmitter } from 'expo-modules-core';
import { EventEmitter } from "expo-modules-core";

const emitter = new EventEmitter({} as any);

export default {
PI: Math.PI,
async setValueAsync(value: string): Promise<void> {
emitter.emit('onChange', { value });
emitter.emit("onChange", { value });
},
hello() {
return 'Hello world! 👋';
return "Hello world! 👋";
},
};
8 changes: 4 additions & 4 deletions modules/weshd/src/WeshdView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { requireNativeViewManager } from 'expo-modules-core';
import * as React from 'react';
import { requireNativeViewManager } from "expo-modules-core";
import * as React from "react";

import { WeshdViewProps } from './Weshd.types';
import { WeshdViewProps } from "./Weshd.types";

const NativeView: React.ComponentType<WeshdViewProps> =
requireNativeViewManager('Weshd');
requireNativeViewManager("Weshd");

export default function WeshdView(props: WeshdViewProps) {
return <NativeView {...props} />;
Expand Down
4 changes: 2 additions & 2 deletions modules/weshd/src/WeshdView.web.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as React from "react";

import { WeshdViewProps } from './Weshd.types';
import { WeshdViewProps } from "./Weshd.types";

export default function WeshdView(props: WeshdViewProps) {
return (
Expand Down
9 changes: 4 additions & 5 deletions packages/components/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
import React, { useEffect, useRef, useState } from "react";
import {
LayoutChangeEvent,
TouchableOpacity,
Expand All @@ -7,7 +7,6 @@ import {
} from "react-native";

import { DefaultValue, useDropdowns } from "../context/DropdownsProvider";
type Position = "top" | "bottom" | "left" | "right" | "auto";

interface DropdownProps {
children:
Expand All @@ -26,7 +25,7 @@ export const Dropdown = ({
onDropdownClosed,
positionStyle = {},
}: DropdownProps) => {
const [layout, setLayout] = useState({
const [, setLayout] = useState({
height: 0,
width: 0,
});
Expand All @@ -47,15 +46,15 @@ export const Dropdown = ({
if (!copyDropdownOpen && isDropdownOpen(dropdownRef)) {
setCopyDropdownOpen(true);
}
}, [openedDropdownRef]);
}, [copyDropdownOpen, isDropdownOpen, onDropdownClosed, openedDropdownRef]);

const handleLayout = ({ nativeEvent: { layout } }: LayoutChangeEvent) => {
setLayout(layout);
};

useEffect(() => {
!triggerComponent && onPressDropdownButton(dropdownRef);
}, []);
}, [onPressDropdownButton, triggerComponent]);

return (
<View
Expand Down
4 changes: 1 addition & 3 deletions packages/components/FilePreview/ImageView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import React, { useState } from "react";
import {
Image,
ImageStyle,
Expand All @@ -7,9 +7,7 @@ import {
View,
} from "react-native";

import { DeleteButton } from "./DeleteButton";
import { ImagesFullViewModal } from "./ImagesFullViewModal";
import { ipfsURLToHTTPURL } from "./ipfs";
import { errorColor } from "../../utils/style/colors";
import { fontSemibold13 } from "../../utils/style/fonts";
import { layout } from "../../utils/style/layout";
Expand Down
2 changes: 1 addition & 1 deletion packages/components/NetworkIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { startCase, camelCase } from "lodash";
import { camelCase } from "lodash";
import React from "react";

import { SVG } from "./SVG";
Expand Down
10 changes: 5 additions & 5 deletions packages/components/NetworkSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import React, { useRef } from "react";
import { StyleProp, TouchableOpacity, View, ViewStyle } from "react-native";
import { useSelector } from "react-redux";

import { BrandText } from "./BrandText";
import { NetworkIcon } from "./NetworkIcon";
import { SVG } from "./SVG";
import { TertiaryBox } from "./boxes/TertiaryBox";
import { SpacerRow } from "./spacer";
import chevronDownSVG from "../../assets/icons/chevron-down.svg";
import chevronUpSVG from "../../assets/icons/chevron-up.svg";
import { useDropdowns } from "../context/DropdownsProvider";
Expand All @@ -24,11 +29,6 @@ import { neutral17, secondaryColor } from "../utils/style/colors";
import { fontSemibold12 } from "../utils/style/fonts";
import { layout } from "../utils/style/layout";
import { WalletProvider } from "../utils/walletProvider";
import { BrandText } from "./BrandText";
import { NetworkIcon } from "./NetworkIcon";
import { SVG } from "./SVG";
import { TertiaryBox } from "./boxes/TertiaryBox";
import { SpacerRow } from "./spacer";

export const NetworkSelector: React.FC<{
style?: StyleProp<ViewStyle>;
Expand Down
1 change: 0 additions & 1 deletion packages/components/ScreenContainer/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { View, ViewStyle, StyleProp } from "react-native";

import { Notification } from "./Notification";
import { neutral33 } from "../../utils/style/colors";
import { headerHeight, layout } from "../../utils/style/layout";
import { BackButton } from "../navigation/components/BackButton";
Expand Down
27 changes: 3 additions & 24 deletions packages/components/ScreenContainer/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,14 @@ import { useSelector } from "react-redux";

import notificationIcon from "../../../assets/icons/badge.svg";
import { useDropdowns } from "../../context/DropdownsProvider";
import {
getNetwork,
NetworkInfo,
NetworkKind,
selectableNetworks,
} from "../../networks";
import { NetworkKind } from "../../networks";
import { selectNotification } from "../../store/slices/notification";
import {
setSelectedWalletId,
setSelectedNetworkId,
selectAreTestnetsEnabled,
} from "../../store/slices/settings";
import { useAppDispatch } from "../../store/store";
import { neutral17, secondaryColor } from "../../utils/style/colors";
import { fontSemibold12 } from "../../utils/style/fonts";
import { layout } from "../../utils/style/layout";
import { WalletProvider } from "../../utils/walletProvider";
import { BrandText } from "../BrandText";
import { NetworkIcon } from "../NetworkIcon";
import { SVG } from "../SVG";
import { TertiaryBox } from "../boxes/TertiaryBox";
import { SpacerRow } from "../spacer";

export const Notification: React.FC<{
style?: StyleProp<ViewStyle>;
Expand All @@ -34,17 +20,10 @@ export const Notification: React.FC<{
hideDropdown?: string;
iconHide?: string;
}> = ({ style, forceNetworkId, forceNetworkKind, hideDropdown, iconHide }) => {
const { onPressDropdownButton, isDropdownOpen, closeOpenedDropdown } =
useDropdowns();
const { onPressDropdownButton, isDropdownOpen } = useDropdowns();
const dropdownRef = useRef<View>(null);
const dispatch = useAppDispatch();
const notifications = useSelector(selectNotification);

const onPressNetwork = (networkId: string) => {
closeOpenedDropdown();
};

const fontSize = 14;
const notifications = useSelector(selectNotification);

return (
<View style={style} ref={dropdownRef}>
Expand Down
29 changes: 1 addition & 28 deletions packages/components/ScreenContainer/ScreenContainerMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import React, { FC, useCallback } from "react";
import React, { FC } from "react";
import {
Platform,
SafeAreaView,
ScrollView,
StyleSheet,
useWindowDimensions,
View,
Text,
} from "react-native";

import { HeaderMobile } from "./HeaderMobile";
import { useSearchBar } from "../../context/SearchBarProvider";
import { useMaxResolution } from "../../hooks/useMaxResolution";
import { NetworkFeature, NetworkInfo, NetworkKind } from "../../networks";
import { DAppStoreData } from "../../screens/DAppStore/components/DAppStoreData";
import SideBarChats from "../../screens/Message/components/SideBarChats";
import { neutral33, neutral77 } from "../../utils/style/colors";
import { fontBold12 } from "../../utils/style/fonts";
import {
Expand Down Expand Up @@ -70,31 +68,6 @@ export const ScreenContainerMobile: FC<{
const { isSearchModalMobileOpen, setSearchModalMobileOpen } = useSearchBar();
const { height: windowHeight, width: windowWidth } = useWindowDimensions();

const Children: FC = useCallback(() => {
return (
<>
{!!mobileTitle && Platform.OS === "web" ? (
<View
style={{
height: 48,
borderBottomWidth: 1,
flexDirection: "row",
alignItems: "center",
borderBottomColor: neutral33,
paddingHorizontal:
getMobileScreenContainerMarginHorizontal(windowWidth),
}}
>
<BrandText style={[fontBold12, { color: neutral77 }]}>
{mobileTitle}
</BrandText>
</View>
) : null}
{children}
</>
);
}, [mobileTitle, children, windowWidth]);

return (
<SafeAreaView style={styles.container}>
<DAppStoreData />
Expand Down
2 changes: 1 addition & 1 deletion packages/components/ScreenContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ConnectWalletButton } from "../TopMenu/ConnectWalletButton";
import { Footer } from "../footers/Footer";
import { Sidebar } from "../navigation/Sidebar";
import { CartIconButtonBadge } from "../navigation/components/CartIconButtonBadge";
import { SpacerColumn, SpacerRow } from "../spacer";
import { SpacerRow } from "../spacer";

export const ScreenContainer: React.FC<{
headerChildren?: JSX.Element;
Expand Down
12 changes: 3 additions & 9 deletions packages/components/ShareScreen/ShareScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import React from "react";
import { View } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";
import { Avatar, Badge } from "react-native-paper";
import { Avatar } from "react-native-paper";

import { Separator } from "../../components/Separator";
import {
neutral22,
neutral30,
neutralA3,
primaryColor,
secondaryColor,
} from "../../utils/style/colors";
import {
fontSemibold11,
fontSemibold13,
fontSemibold14,
} from "../../utils/style/fonts";
import { fontSemibold13, fontSemibold14 } from "../../utils/style/fonts";
import { BrandText } from "../BrandText";
import FlexRow from "../FlexRow";
import { TertiaryBox } from "../boxes/TertiaryBox";
Expand All @@ -27,8 +22,7 @@ type Props = {
avatar: any;
};

const ScreenShare: React.FC<Props> = ({ avatar, name, isOnline }) => {
const onlineStatusBadgeColor = isOnline ? "green" : "yellow";
const ScreenShare: React.FC<Props> = ({ avatar, name }) => {
return (
<View>
<FlexRow justifyContent="space-between">
Expand Down
1 change: 0 additions & 1 deletion packages/components/addfriend/AddFriendList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
fontSemibold13,
fontSemibold14,
} from "../../utils/style/fonts";
import { weshClient } from "../../weshnet/client";
import { BrandText } from "../BrandText";
import FlexRow from "../FlexRow";
import { TertiaryBox } from "../boxes/TertiaryBox";
Expand Down
2 changes: 1 addition & 1 deletion packages/components/cards/MessageCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC } from "react";
import { Text, StyleSheet } from "react-native";
import { StyleSheet } from "react-native";

import {
neutral00,
Expand Down
7 changes: 3 additions & 4 deletions packages/components/friends/FriendsList.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from "react";
import { View, Image, StyleSheet } from "react-native";
import { View } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";
import { Avatar, Badge } from "react-native-paper";

import chaticon from "../../../assets/icons/chaticon.svg";
import dots from "../../../assets/icons/dots.svg";
import { Separator } from "../../components/Separator";
import { useNSUserInfo } from "../../hooks/useNSUserInfo";
import { neutral22, neutralA3, secondaryColor } from "../../utils/style/colors";
import { fontSemibold13, fontSemibold11 } from "../../utils/style/fonts";
import { neutral22, secondaryColor } from "../../utils/style/colors";
import { fontSemibold13 } from "../../utils/style/fonts";
import { Conversation } from "../../utils/types/message";
import {
getConversationAvatar,
Expand Down
3 changes: 1 addition & 2 deletions packages/components/modals/ModalBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
ViewStyle,
useWindowDimensions,
StyleProp,

} from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";

import chevronLeft from "../../../assets/icons/chevron-left.svg";
import closeSVG from "../../../assets/icons/hamburger-button-cross.svg";
Expand All @@ -21,7 +21,6 @@ import { SVG } from "../SVG";
import { SeparatorGradient } from "../SeparatorGradient";
import { TertiaryBox } from "../boxes/TertiaryBox";
import { SpacerColumn } from "../spacer";
import { TouchableOpacity } from "react-native-gesture-handler";

// TODO: Simplify this component (Useless childrenBottom ?. Better to let the parent totally decides which children to use ? Used in WalletManager.tsx, be careful !)

Expand Down
3 changes: 0 additions & 3 deletions packages/components/navigation/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import addSVG from "../../../assets/icons/add-circle.svg";
import chevronRightSVG from "../../../assets/icons/chevron-right.svg";
import { useSidebar } from "../../context/SidebarProvider";
import { useCurrentRouteName } from "../../hooks/useCurrentRouteName";
import { useNSUserInfo } from "../../hooks/useNSUserInfo";
import { useSelectedNetworkKind } from "../../hooks/useSelectedNetwork";
import useSelectedWallet from "../../hooks/useSelectedWallet";
import { NetworkKind } from "../../networks";
Expand Down Expand Up @@ -60,9 +59,7 @@ interface SidebarProps extends DrawerContentComponentProps {

export const Sidebar = (props: SidebarProps) => {
const selectedWallet = useSelectedWallet();
const userInfo = useNSUserInfo(selectedWallet?.userId);
const selectedNetworkKind = useSelectedNetworkKind();
const connected = selectedWallet?.connected;
const { top, bottom } = useSafeAreaInsets();

// variables
Expand Down
Loading

0 comments on commit 064af2e

Please sign in to comment.