@jsb188/app 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,30 +24,25 @@ export function makeUploadsUrl(
24
24
  return '';
25
25
  }
26
26
 
27
- let uriPrefix;
28
- if (
29
- urlPath.substring(urlPath.lastIndexOf('.')).toLowerCase() === '.gif' &&
30
- animateGifs
31
- ) {
32
- uriPrefix = 'original/';
27
+ const isGif = urlPath.substring(urlPath.lastIndexOf('.')).toLowerCase() === '.gif';
28
+
29
+ let prefix = '';
30
+ if (isGif && animateGifs) {
31
+ // Do gif path here
32
+ prefix = '';
33
33
  } else {
34
- switch (size) {
35
- case 'original':
36
- uriPrefix = 'original/';
37
- break;
38
- case 'large':
39
- case 'medium':
40
- uriPrefix = 'medium/';
41
- break;
42
- case 'small':
43
- case 'tiny':
44
- uriPrefix = 'small/';
45
- break;
46
- default:
47
- uriPrefix = 'small/';
48
- }
34
+ // Do size paths here
49
35
  }
50
- return 'https://static.chiefhappiness.co/' + uriPrefix + urlPath;
36
+
37
+ return 'https://assets.chiefhappiness.co/' + prefix + urlPath;
38
+ }
39
+
40
+ /**
41
+ * Make url for static assets
42
+ */
43
+
44
+ export function makeStaticAssetUrl(urlPath?: string | null): string {
45
+ return 'https://assets.chiefhappiness.co/marketday/static/' + urlPath;
51
46
  }
52
47
 
53
48
  /**
package/utils/user.ts CHANGED
@@ -1,4 +1,3 @@
1
- import i18n from '../i18n/';
2
1
 
3
2
  /**
4
3
  * Types
@@ -93,110 +92,6 @@ export function resolveOnlineStatus(user: object, viewerUserId: number) {
93
92
  return 'APPEAR_OFFLINE';
94
93
  }
95
94
 
96
- /**
97
- * Get friend status between 2 users
98
- */
99
-
100
- export function getFriendOptions(friend?: FriendFragment | null): FriendOptionsObj {
101
- const { myStatus, otherStatus } = friend || {};
102
- if (myStatus === 'BLOCKED') {
103
- // Blocked by user
104
-
105
- return {
106
- friendButtonText: i18n.t('user.blocked'),
107
- friendStatusText: i18n.t('user.blocked_by_me'),
108
- friendButtonIconName: 'user-x',
109
- messageAllowed: false,
110
- options: [{
111
- value: 'DECLINED',
112
- iconName: 'user',
113
- text: i18n.t('user.unblock'),
114
- }],
115
- };
116
- } else if (otherStatus === 'BLOCKED') {
117
- // Blocked by "other" user
118
-
119
- return {
120
- friendButtonText: i18n.t('user.blocked'),
121
- friendStatusText: i18n.t('user.blocked_by_other'),
122
- friendButtonIconName: 'user-x',
123
- messageAllowed: false,
124
- options: [],
125
- };
126
- } else if (myStatus === 'ACCEPTED' && otherStatus === 'ACCEPTED') {
127
- // Friends
128
-
129
- return {
130
- friendButtonText: i18n.t('user.friends'),
131
- friendStatusText: i18n.t('user.friends_msg'),
132
- friendButtonIconName: 'user-check',
133
- messageAllowed: true,
134
- options: [{
135
- value: 'DECLINED',
136
- iconName: 'user-cancel',
137
- text: i18n.t('user.remove_friend'),
138
- }, {
139
- value: 'BLOCKED',
140
- iconName: 'user-x',
141
- text: i18n.t('user.block'),
142
- }],
143
- };
144
- } else if (myStatus === 'PENDING') {
145
- // Pending request from other user
146
-
147
- return {
148
- friendButtonText: i18n.t('user.friend_request'),
149
- friendStatusText: i18n.t('user.add_friend_msg'),
150
- friendButtonIconName: 'user-plus',
151
- messageAllowed: false,
152
- options: [{
153
- value: 'ACCEPTED',
154
- iconName: 'user-check',
155
- text: i18n.t('user.accept_friend'),
156
- }, {
157
- value: 'DECLINED',
158
- iconName: 'user-cancel',
159
- text: i18n.t('user.ignore_friend'),
160
- }, {
161
- value: 'BLOCKED',
162
- iconName: 'user-x',
163
- text: i18n.t('user.block'),
164
- }],
165
- };
166
- } else if (otherStatus === 'PENDING') {
167
- // Sent a friend request; now waiting
168
-
169
- return {
170
- friendButtonText: i18n.t('user.friend_requested'),
171
- friendStatusText: i18n.t('user.sent_friend_msg'),
172
- friendButtonIconName: 'mail',
173
- messageAllowed: false,
174
- options: [{
175
- value: 'DECLINED',
176
- iconName: 'user-cancel',
177
- text: i18n.t('user.cancel_friend'),
178
- }],
179
- };
180
- }
181
-
182
- // No actions taken, user can/should send request
183
- return {
184
- friendButtonText: i18n.t('user.add_friend'),
185
- friendStatusText: i18n.t('user.add_friend_msg'),
186
- friendButtonIconName: 'user-plus',
187
- messageAllowed: false,
188
- options: [{
189
- value: 'PENDING',
190
- iconName: 'mail',
191
- text: i18n.t('user.send_friend'),
192
- }, {
193
- value: 'BLOCKED',
194
- iconName: 'user-x',
195
- text: i18n.t('user.block'),
196
- }],
197
- };
198
- }
199
-
200
95
  /**
201
96
  * Get user subscription type
202
97
  */
package/types/user.d.ts DELETED
@@ -1,52 +0,0 @@
1
- import type { PersonaObj } from './chat';
2
-
3
- type OnlineStatusEnum = null | 'AWAY' | 'BUSY' | 'APPEAR_OFFLINE';
4
- type PlusStatusEnum = 'PRO' | 'PLUS' | 'PERKS' | 'NORMAL';
5
-
6
- export interface AppUser {
7
- id: string;
8
- username: string;
9
- displayName: string;
10
-
11
- moderator: boolean;
12
- activated: boolean;
13
-
14
- plusStatus: PlusStatusEnum;
15
- onlineStatus: OnlineStatusEnum;
16
-
17
- plus: {
18
- id: string;
19
- expireAt: string;
20
- cancelled: boolean;
21
- type: string;
22
- };
23
-
24
- theme: {
25
- id: string;
26
- name: string;
27
- backgroundPhotoUri: string;
28
- };
29
-
30
- profile: {
31
- id: string;
32
- description: string;
33
- pronouns: string;
34
- photoUri: string;
35
- backgroundPhotoUri: string;
36
- adult: boolean;
37
- };
38
-
39
- email: {
40
- id: string;
41
- address: string;
42
- verified: boolean;
43
- };
44
-
45
- phone: {
46
- id: string;
47
- number: string;
48
- verified: boolean;
49
- };
50
-
51
- personas: PersonaObj[];
52
- }