aboutsummaryrefslogtreecommitdiff
path: root/src/store/initialStates.ts
blob: 87e1ce229fe75c9ee1f5d409df90bcc7eff4ab70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import {
  ExploreSectionType,
  MomentType,
  NotificationType,
  ProfilePreviewType,
  ProfileType,
  ScreenType,
  SocialAccountType,
  UserType,
  UserXType,
} from '../types';

export const NO_PROFILE: ProfileType = {
  biography: '',
  website: '',
  name: '',
  gender: '',
  birthday: undefined,
  university_class: 2021,
  profile_completion_stage: 1,
  snapchat: '',
  tiktok: '',
};

export const EMPTY_MOMENTS_LIST = <MomentType[]>[];

export const EMPTY_NOTIFICATIONS_LIST = <NotificationType[]>[];

export const NO_USER: UserType = {
  userId: '',
  username: '',
};

export const EMPTY_PROFILE_PREVIEW_LIST = <ProfilePreviewType[]>[];

export const NO_USER_DATA = {
  user: <UserType>NO_USER,
  profile: <ProfileType>NO_PROFILE,
  avatar: <string | null>'',
  cover: <string | null>'',
  isOnboardedUser: false,
};

export const NO_FRIENDS_DATA = {
  friends: EMPTY_PROFILE_PREVIEW_LIST,
};

export const NO_NOTIFICATIONS = {
  notifications: EMPTY_NOTIFICATIONS_LIST,
};

export const NO_MOMENTS = {
  moments: EMPTY_MOMENTS_LIST,
};

export const NO_SOCIAL_ACCOUNTS: Record<string, SocialAccountType> = {
  Instagram: {posts: []},
  Facebook: {posts: []},
  Twitter: {posts: []},
};

export const EMPTY_EXPLORE_SECTIONS: Record<
  ExploreSectionType,
  ProfilePreviewType[]
> = {
  'People You May Know': EMPTY_PROFILE_PREVIEW_LIST,
  'New to Tagg': EMPTY_PROFILE_PREVIEW_LIST,
  'Trending on Tagg': EMPTY_PROFILE_PREVIEW_LIST,
  "Brown '21": EMPTY_PROFILE_PREVIEW_LIST,
  "Brown '22": EMPTY_PROFILE_PREVIEW_LIST,
  "Brown '23": EMPTY_PROFILE_PREVIEW_LIST,
};

export const NO_TAGG_USERS = {
  recentSearches: EMPTY_PROFILE_PREVIEW_LIST,
  explores: EMPTY_EXPLORE_SECTIONS,
};

export const NO_SOCIALS = {
  socialAccounts: NO_SOCIAL_ACCOUNTS,
};

export const NO_BLOCKED_USERS = {
  blockedUsers: EMPTY_PROFILE_PREVIEW_LIST,
};

export const EMPTY_MOMENT_CATEGORIES: string[] = [];

/**
 * The dummy userId and username serve the purpose of preventing app crash
 * For instance, if it may happen that data in our store is not loaded yet for the userXId being visited.
 * Then we will set the userXId / username to this dummy username / userid
 */
export const DUMMY_USERID = 'ID-1234-567';
export const DUMMY_USERNAME = 'tagg_userX';

export const EMPTY_USER_X = <UserXType>{
  friends: EMPTY_PROFILE_PREVIEW_LIST,
  moments: EMPTY_MOMENTS_LIST,
  momentCategories: EMPTY_MOMENT_CATEGORIES,
  socialAccounts: NO_SOCIAL_ACCOUNTS,
  user: NO_USER,
  profile: NO_PROFILE,
  avatar: '',
  cover: '',
};

/**
 * A dummy userX to always be there in out initial app state
 */
export const EMPTY_USERX_LIST = <Record<string, UserXType>>{
  [DUMMY_USERID]: EMPTY_USER_X,
};

export const EMPTY_SCREEN_TO_USERS_LIST: Record<
  ScreenType,
  Record<string, UserXType>
> = {
  [ScreenType.Profile]: EMPTY_USERX_LIST,
  [ScreenType.Search]: EMPTY_USERX_LIST,
  [ScreenType.Notifications]: EMPTY_USERX_LIST,
};

export const INITIAL_CATEGORIES_STATE = {
  momentCategories: EMPTY_MOMENT_CATEGORIES,
};