From 6883f2708330f60525fbcc16355346b8af974ec5 Mon Sep 17 00:00:00 2001
From: Jason Lee <123986245+sleeper-jasonl@users.noreply.github.com>
Date: Thu, 7 Dec 2023 10:12:26 -0800
Subject: [PATCH] Adding avatars & per sport league lists (#26)
---
bin/build_mini.js | 0
bin/preload_packages.js | 0
declarations/avatar/index.d.ts | 23 +++++
declarations/index.d.ts | 5 +-
declarations/jersey/index.d.ts | 2 +-
declarations/navigation/index.d.ts | 2 +-
declarations/sleeper_actions.d.ts | 2 +-
declarations/sleeper_context.d.ts | 6 +-
declarations/sleeper_message.d.ts | 3 +-
declarations/switch/index.d.ts | 4 +-
.../types/components/app_icon_switch.d.ts | 24 ++++++
declarations/types/components/jersey.d.ts | 3 +
.../components/ui_2/app_icon_switch.d.ts | 18 ----
declarations/types/index.d.ts | 83 ++-----------------
declarations/types/minis/index.d.ts | 71 ++++++++++++++++
declarations/types/shared/graphql.d.ts | 57 ++++++-------
declarations/types/utils/toast_helper.d.ts | 2 +-
package.json | 4 +-
src/components/index.tsx | 35 +++++++-
19 files changed, 209 insertions(+), 135 deletions(-)
mode change 100644 => 100755 bin/build_mini.js
mode change 100644 => 100755 bin/preload_packages.js
create mode 100644 declarations/avatar/index.d.ts
create mode 100644 declarations/types/components/app_icon_switch.d.ts
create mode 100644 declarations/types/components/jersey.d.ts
delete mode 100644 declarations/types/components/ui_2/app_icon_switch.d.ts
create mode 100644 declarations/types/minis/index.d.ts
diff --git a/bin/build_mini.js b/bin/build_mini.js
old mode 100644
new mode 100755
diff --git a/bin/preload_packages.js b/bin/preload_packages.js
old mode 100644
new mode 100755
diff --git a/declarations/avatar/index.d.ts b/declarations/avatar/index.d.ts
new file mode 100644
index 0000000..b8899bb
--- /dev/null
+++ b/declarations/avatar/index.d.ts
@@ -0,0 +1,23 @@
+import React from "react";
+import { League, Player, User } from "@sleeperhq/mini-core/declarations/types/shared/graphql.d";
+export interface AvatarProps {
+ user: User;
+ width?: number;
+}
+export declare const Avatar: React.MemoExoticComponent<(props: AvatarProps) => JSX.Element>;
+export interface AvatarPlayerProps {
+ player: Player;
+ width?: number;
+}
+export declare const AvatarPlayer: React.MemoExoticComponent<(props: AvatarPlayerProps) => JSX.Element>;
+export interface AvatarTeamProps {
+ team: string;
+ sport: string;
+ width?: number;
+}
+export declare const AvatarTeam: React.MemoExoticComponent<(props: AvatarTeamProps) => JSX.Element>;
+export interface AvatarLeagueProps {
+ league: League;
+ width?: number;
+}
+export declare const AvatarLeague: React.MemoExoticComponent<(props: AvatarLeagueProps) => JSX.Element>;
diff --git a/declarations/index.d.ts b/declarations/index.d.ts
index e8d2bcf..07664c0 100644
--- a/declarations/index.d.ts
+++ b/declarations/index.d.ts
@@ -1,4 +1,3 @@
-export * from './types';
-export * from './sleeper_message';
-declare const _default: any;
+///
+declare const _default: (props: any) => JSX.Element;
export default _default;
diff --git a/declarations/jersey/index.d.ts b/declarations/jersey/index.d.ts
index 4a2f4b3..1ad6e61 100644
--- a/declarations/jersey/index.d.ts
+++ b/declarations/jersey/index.d.ts
@@ -1,5 +1,5 @@
import { ColorValue, ViewStyle } from 'react-native';
-import SleeperJersey from 'components/ui/jersey';
+import SleeperJersey from '@sleeperhq/mini-core/declarations/types/components/jersey.d';
export interface JerseyProps {
style: ViewStyle;
sport: 'nfl' | 'nba' | 'cbb' | 'cfb' | 'mlb';
diff --git a/declarations/navigation/index.d.ts b/declarations/navigation/index.d.ts
index 88284c4..0eca57e 100644
--- a/declarations/navigation/index.d.ts
+++ b/declarations/navigation/index.d.ts
@@ -1,4 +1,4 @@
-import type { LeagueId, PlayerId, RosterId, SportType, TransactionId } from '..';
+import type { LeagueId, PlayerId, RosterId, SportType, TransactionId } from '@sleeperhq/mini-core/declarations/types';
export type NavigationParams = {
LeaguesIndexScreen: undefined;
LeaguesDetailScreen: LeaguesDetailScreenParams;
diff --git a/declarations/sleeper_actions.d.ts b/declarations/sleeper_actions.d.ts
index 18c2db6..bf49522 100644
--- a/declarations/sleeper_actions.d.ts
+++ b/declarations/sleeper_actions.d.ts
@@ -1,4 +1,4 @@
-import { NavigationParams, NavigationScreen, ToastConfig, Notification } from './types';
+import { NavigationParams, NavigationScreen, ToastConfig, Notification } from '@sleeperhq/mini-core/declarations/types';
export type SleeperActions = {
navigate?: (screen: T, params?: NavigationParams[T]) => void;
requestLocation?: () => void;
diff --git a/declarations/sleeper_context.d.ts b/declarations/sleeper_context.d.ts
index d271d5a..c714d90 100644
--- a/declarations/sleeper_context.d.ts
+++ b/declarations/sleeper_context.d.ts
@@ -1,11 +1,13 @@
-import { User, League, LeaguesMap, RostersInLeagueMap, UserMap, MatchupsInLeagueMap, UsersInLeagueMap, PlayoffsInLeagueMap, TransactionsInLeagueMap, TransactionsMap, SportInfoMap, DraftsInLeagueMap, DraftPickTradesInLeagueMap, DraftPicksInDraftMap, PlayersInSportMap, Topic, Location } from './types';
-import type { SleeperActions } from './sleeper_actions';
+import { User, League, LeaguesMap, RostersInLeagueMap, UserMap, MatchupsInLeagueMap, UsersInLeagueMap, PlayoffsInLeagueMap, TransactionsInLeagueMap, TransactionsMap, SportInfoMap, DraftsInLeagueMap, DraftPickTradesInLeagueMap, DraftPicksInDraftMap, PlayersInSportMap, Topic, Location, SportType } from '@sleeperhq/mini-core/declarations/types';
+import type { SleeperActions } from '@sleeperhq/mini-core/declarations/sleeper_actions';
declare class SleeperContext {
static apiLevel: string;
user: User;
league: League;
leaguesMap: LeaguesMap;
+ leaguesMapBySport: Record;
userLeagueList: string[];
+ userLeagueListBySport: Record;
rostersInLeagueMap: RostersInLeagueMap;
userMap: UserMap;
matchupsInLeagueMap: MatchupsInLeagueMap;
diff --git a/declarations/sleeper_message.d.ts b/declarations/sleeper_message.d.ts
index 5899347..e00867c 100644
--- a/declarations/sleeper_message.d.ts
+++ b/declarations/sleeper_message.d.ts
@@ -1,4 +1,4 @@
-import type { Entitlement, HeaderOptions } from './types';
+import type { Entitlement, HeaderOptions, Metadata } from '@sleeperhq/mini-core/declarations/types';
type SocketMessage = {
_ip?: string;
_name?: string;
@@ -7,5 +7,6 @@ type SocketMessage = {
_description?: string;
_entitlements?: Entitlement[];
_headerOptions?: HeaderOptions;
+ _metadata?: Metadata;
};
export default SocketMessage;
diff --git a/declarations/switch/index.d.ts b/declarations/switch/index.d.ts
index c94bf5d..b193757 100644
--- a/declarations/switch/index.d.ts
+++ b/declarations/switch/index.d.ts
@@ -1,3 +1,3 @@
-import { AppIconSwitch } from '../types/components/ui_2/app_icon_switch';
-export type { SwitchOption, Props as SwitchProps } from '../types/components/ui_2/app_icon_switch';
+import { AppIconSwitch } from '@sleeperhq/mini-core/declarations/types/components/app_icon_switch.d';
+export type { SwitchOption, Props as SwitchProps } from '@sleeperhq/mini-core/declarations/types/components/app_icon_switch.d';
export default AppIconSwitch;
diff --git a/declarations/types/components/app_icon_switch.d.ts b/declarations/types/components/app_icon_switch.d.ts
new file mode 100644
index 0000000..58e7d0c
--- /dev/null
+++ b/declarations/types/components/app_icon_switch.d.ts
@@ -0,0 +1,24 @@
+import React from 'react';
+import { StyleProp, ViewStyle } from 'react-native';
+export type SwitchOption = {
+ colorToggleActive: string;
+ colorIconActive: string;
+ colorIconInactive?: string;
+ iconStyle?: any;
+ icon: any;
+ iconInactive?: any;
+ text?: string;
+ hideIconInactive?: boolean;
+};
+export type Props = {
+ options: [SwitchOption, SwitchOption];
+ value?: number;
+ onChange?: (value: number) => void;
+ height?: number;
+ width?: number;
+ containerStyle?: StyleProp;
+ toggleStyle?: StyleProp;
+ aspectRatio?: number;
+ confirmationFunction?: (nextSelection: 'on' | 'off', continueAction: () => void) => void;
+};
+export declare const AppIconSwitch: React.MemoExoticComponent<({ height, options, value, width, onChange, containerStyle, toggleStyle, aspectRatio, confirmationFunction }: Props) => JSX.Element>;
diff --git a/declarations/types/components/jersey.d.ts b/declarations/types/components/jersey.d.ts
new file mode 100644
index 0000000..aeba3fe
--- /dev/null
+++ b/declarations/types/components/jersey.d.ts
@@ -0,0 +1,3 @@
+export default Jersey;
+declare const Jersey: React.NamedExoticComponent