be-components 7.0.2 → 7.0.3
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.
- package/lib/commonjs/Squares/api/index.js +10 -2
- package/lib/commonjs/Squares/api/index.js.map +1 -1
- package/lib/commonjs/Squares/index.js +63 -1
- package/lib/commonjs/Squares/index.js.map +1 -1
- package/lib/commonjs/SquaresManager/api/index.js +10 -0
- package/lib/commonjs/SquaresManager/api/index.js.map +1 -1
- package/lib/commonjs/SquaresManager/index.js +111 -13
- package/lib/commonjs/SquaresManager/index.js.map +1 -1
- package/lib/module/Squares/api/index.js +10 -2
- package/lib/module/Squares/api/index.js.map +1 -1
- package/lib/module/Squares/index.js +63 -1
- package/lib/module/Squares/index.js.map +1 -1
- package/lib/module/SquaresManager/api/index.js +10 -0
- package/lib/module/SquaresManager/api/index.js.map +1 -1
- package/lib/module/SquaresManager/index.js +111 -13
- package/lib/module/SquaresManager/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Squares/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/Squares/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Squares/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SquaresManager/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/SquaresManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SquaresManager/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/SquaresManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Squares/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/Squares/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Squares/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SquaresManager/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/SquaresManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SquaresManager/index.d.ts +2 -1
- package/lib/typescript/lib/module/SquaresManager/index.d.ts.map +1 -1
- package/lib/typescript/src/Squares/api/index.d.ts +7 -0
- package/lib/typescript/src/Squares/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Squares/index.d.ts.map +1 -1
- package/lib/typescript/src/SquaresManager/api/index.d.ts +1 -0
- package/lib/typescript/src/SquaresManager/api/index.d.ts.map +1 -1
- package/lib/typescript/src/SquaresManager/index.d.ts +2 -1
- package/lib/typescript/src/SquaresManager/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Squares/api/index.ts +8 -2
- package/src/Squares/index.tsx +38 -1
- package/src/SquaresManager/api/index.ts +8 -0
- package/src/SquaresManager/index.tsx +78 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../module/SquaresManager/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../module/SquaresManager/index.js"],"names":[],"mappings":";AAaA;;;;;;;;;;kGAytBC;kBAtuB0C,OAAO"}
|
|
@@ -2,6 +2,13 @@ import type { BuySquaresResponseProps, EventProps, LeagueProps, OfferResponsePro
|
|
|
2
2
|
export { SquaresApi, SqauresHelpers };
|
|
3
3
|
declare const SquaresApi: {
|
|
4
4
|
setEnvironment: () => void;
|
|
5
|
+
activateSquares: (sq_comp_id: string) => Promise<undefined | {
|
|
6
|
+
squares_competition: SquaresCompetitionProps;
|
|
7
|
+
player_squares: PlayerSquareProps[];
|
|
8
|
+
squares: SquareProps[];
|
|
9
|
+
squares_payout_type: SquaresPayoutProps;
|
|
10
|
+
squares_type: SquaresTypeProps;
|
|
11
|
+
}>;
|
|
5
12
|
getSquareCompetitionById: (sq_comp_id: string) => Promise<{
|
|
6
13
|
squares_competition: SquaresCompetitionProps;
|
|
7
14
|
square_results: SquareResultProps[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/Squares/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uB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CAAC;QAAC,MAAM,EAAC,MAAM,CAAA;KAAE,CAAC;IACvC,qBAAqB,EAAE,CAAC,gBAAgB,CAAC,EAAC,MAAM,KAAK,IAAI,CAAC;IAC1D,kBAAkB,EAAC,CAAC,mBAAmB,EAAC,uBAAuB,KAAK,IAAI,CAAC;IACzE,cAAc,EAAC,CAAC,MAAM,EAAC,iBAAiB,KAAK,IAAI,CAAC;IAClD,OAAO,EAAC,CAAC,EAAE,EAAC,YAAY,KAAK,IAAI,CAAA;CACpC,CAAA;AAID,QAAA,MAAM,aAAa,GAAI,oJAAmJ,kBAAkB,sBAuqB3L,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -4,6 +4,7 @@ export { SquaresManagerApi };
|
|
|
4
4
|
declare const SquaresManagerApi: {
|
|
5
5
|
setEnvironment: () => void;
|
|
6
6
|
getLeagues: () => Promise<LeagueProps[]>;
|
|
7
|
+
deleteCompetition: (sq_comp_id: string) => Promise<SquaresCompetitionProps | undefined>;
|
|
7
8
|
getEventsByEventIds: (event_ids: string[]) => Promise<EventProps[]>;
|
|
8
9
|
getSquareCompetitionById: (sq_comp_id: string) => Promise<undefined | {
|
|
9
10
|
squares_competition: SquaresCompetitionProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/SquaresManager/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE7P,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMxE,OAAO,EAAE,iBAAiB,EAAE,CAAA;AAG5B,QAAA,MAAM,iBAAiB;;sBASC,OAAO,CAAC,WAAW,E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a,EAAC,gBAAgB,EAAE,CAAA;KAAC,CAAC;oDAS/C,uBAAuB,KAAE,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;kCASvF,MAAM,KAAE,OAAO,CAAC,SAAS,GAAG;QAAE,mBAAmB,EAAC,uBAAuB,CAAA;KAAE,CAAC;CAQjH,CAAA;AAGD,eAAO,MAAM,qBAAqB;8BACL,uBAAuB,yBAAwB,MAAM,sBAAqB,MAAM;CAoB5G,CAAA"}
|
|
@@ -7,10 +7,11 @@ type SquaresManagerProps = {
|
|
|
7
7
|
float?: boolean;
|
|
8
8
|
player?: MyPlayerProps;
|
|
9
9
|
onActivate: (sq: SquaresCompetitionProps) => void;
|
|
10
|
+
onDelete: (sq: SquaresCompetitionProps) => void;
|
|
10
11
|
onClose: () => void;
|
|
11
12
|
header_style?: ViewStyle;
|
|
12
13
|
footer_style?: ViewStyle;
|
|
13
14
|
};
|
|
14
|
-
declare const SquaresManager: ({ sq_comp_id, float, player, header_style, onFocusPosition, footer_style, onClose, onActivate }: SquaresManagerProps) => React.JSX.Element;
|
|
15
|
+
declare const SquaresManager: ({ sq_comp_id, float, player, header_style, onFocusPosition, footer_style, onDelete, onClose, onActivate }: SquaresManagerProps) => React.JSX.Element;
|
|
15
16
|
export default SquaresManager;
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/SquaresManager/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAA4B,kBAAkB,EAA2B,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/SquaresManager/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAA4B,kBAAkB,EAA2B,aAAa,EAAqB,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAUjK,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAC,MAAM,CAAC;IAClB,eAAe,CAAC,EAAC,CAAC,GAAG,EAAC,kBAAkB,KAAK,IAAI,CAAC;IAClD,KAAK,CAAC,EAAC,OAAO,CAAC;IACf,MAAM,CAAC,EAAC,aAAa,CAAC;IACtB,UAAU,EAAC,CAAC,EAAE,EAAC,uBAAuB,KAAK,IAAI,CAAC;IAChD,QAAQ,EAAC,CAAC,EAAE,EAAC,uBAAuB,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAC,MAAM,IAAI,CAAC;IACnB,YAAY,CAAC,EAAC,SAAS,CAAC;IACxB,YAAY,CAAC,EAAC,SAAS,CAAA;CAC1B,CAAA;AAED,QAAA,MAAM,cAAc,GAAI,2GAA0G,mBAAmB,sBA0bpJ,CAAA;AAED,eAAe,cAAc,CAAA"}
|
package/package.json
CHANGED
package/src/Squares/api/index.ts
CHANGED
|
@@ -18,6 +18,14 @@ const SquaresApi = {
|
|
|
18
18
|
//MK_SVC_API = endpoints['MK_SVC_API'] as string;
|
|
19
19
|
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
20
20
|
},
|
|
21
|
+
activateSquares: async(sq_comp_id:string):Promise<undefined | { squares_competition:SquaresCompetitionProps, player_squares:PlayerSquareProps[], squares:SquareProps[], squares_payout_type:SquaresPayoutProps, squares_type:SquaresTypeProps }> => {
|
|
22
|
+
try {
|
|
23
|
+
const resp = await axios.post(`${TP_SVC_API}/v1/squares/competition/activate`, { sq_comp_id });
|
|
24
|
+
return resp.data
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return undefined
|
|
27
|
+
}
|
|
28
|
+
},
|
|
21
29
|
getSquareCompetitionById: async(sq_comp_id:string):Promise<{ squares_competition:SquaresCompetitionProps, square_results:SquareResultProps[], squares:SquareProps[], player_squares:PlayerSquareProps[], square_offers:SquareOfferProps[], squares_type:SquaresTypeProps, squares_payout_type: SquaresPayoutProps, player_square_history:PlayerSquareProps[], square_prizes:SquarePrizeProps[] }> => {
|
|
22
30
|
const resp = await axios.get(`${TP_SVC_API}/tp/squares/comp/details/${sq_comp_id}`)
|
|
23
31
|
return resp.data
|
|
@@ -32,9 +40,7 @@ const SquaresApi = {
|
|
|
32
40
|
},
|
|
33
41
|
getSquaresCompetitionsByCompany:async(company_id:string, status: 'active'|'closed', offset:number):Promise<SquaresCompetitionProps[]> => {
|
|
34
42
|
try {
|
|
35
|
-
console.log(company_id, status, offset)
|
|
36
43
|
const resp = await axios.get(`${TP_SVC_API}/v1/squares/competitions/company/${company_id}?status=${status}&offset=${offset}`);
|
|
37
|
-
console.log(resp.data)
|
|
38
44
|
return resp.data.squares_competitions
|
|
39
45
|
} catch (e) {
|
|
40
46
|
console.log(e);
|
package/src/Squares/index.tsx
CHANGED
|
@@ -34,7 +34,7 @@ type SquaresModuleProps = {
|
|
|
34
34
|
onEvent:(ev:BEEventProps) => void
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const squares_sections = ['header', 'offers', 'toggle', 'event', 'board', 'board_stats', 'my_stats', 'results', 'my_squares', 'winners','hidden_prizes','details', 'owners']
|
|
37
|
+
const squares_sections = ['header', 'activate', 'offers', 'toggle', 'event', 'board', 'board_stats', 'my_stats', 'results', 'my_squares', 'winners','hidden_prizes','details', 'owners']
|
|
38
38
|
|
|
39
39
|
const SquaresModule = ({ sq_comp_id, info_header, view_mode, insets, player_id, distinct_id, onManageSquares, onRequestAuthenticate, onShareCompetition, onPlayerSelect }:SquaresModuleProps) => {
|
|
40
40
|
const C = useColors();
|
|
@@ -334,6 +334,23 @@ const SquaresModule = ({ sq_comp_id, info_header, view_mode, insets, player_id,
|
|
|
334
334
|
})
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
const handleActivate = async() => {
|
|
338
|
+
if(!squares_competition || loading){ return }
|
|
339
|
+
if(squares_competition.status != 'pending'){ return }
|
|
340
|
+
setModuleData({ ...module_data, loading: true });
|
|
341
|
+
const activate_resp = await SquaresApi.activateSquares(squares_competition.sq_comp_id);
|
|
342
|
+
if(!activate_resp){ return alert('Unable to activate competition') }
|
|
343
|
+
setModuleData({
|
|
344
|
+
...module_data,
|
|
345
|
+
squares_competition: activate_resp.squares_competition,
|
|
346
|
+
player_squares: activate_resp.player_squares,
|
|
347
|
+
squares: activate_resp.squares,
|
|
348
|
+
squares_type: activate_resp.squares_type,
|
|
349
|
+
squares_payout_type: activate_resp.squares_payout_type,
|
|
350
|
+
loading: true
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
337
354
|
const handleUpdateBoardFromBuy = (data:BuySquaresResponseProps) => {
|
|
338
355
|
//First remove squares
|
|
339
356
|
//Now update squares
|
|
@@ -378,6 +395,25 @@ const SquaresModule = ({ sq_comp_id, info_header, view_mode, insets, player_id,
|
|
|
378
395
|
</Button>
|
|
379
396
|
</View>
|
|
380
397
|
)
|
|
398
|
+
case 'activate':
|
|
399
|
+
if(squares_competition?.status != 'pending'){ return <></> }
|
|
400
|
+
if(player_id != squares_competition?.admin_id){ return <></> }
|
|
401
|
+
return (
|
|
402
|
+
<View type='row' style={{ padding:10 }}>
|
|
403
|
+
<View style={{ flex:1 }}>
|
|
404
|
+
<Text theme="h2">Squares competition is pending.</Text>
|
|
405
|
+
<Text theme="description" style={{ marginTop:3 }}>Press Activate to allow others to join!</Text>
|
|
406
|
+
</View>
|
|
407
|
+
<Button
|
|
408
|
+
disabled={loading ? true : false}
|
|
409
|
+
style={{ marginLeft:5, padding:10 }}
|
|
410
|
+
loading={loading}
|
|
411
|
+
title="ACTIVATE!"
|
|
412
|
+
type='success'
|
|
413
|
+
onPress={() => handleActivate()}
|
|
414
|
+
/>
|
|
415
|
+
</View>
|
|
416
|
+
)
|
|
381
417
|
case 'event':
|
|
382
418
|
if(!event){ return <></> }
|
|
383
419
|
return (
|
|
@@ -512,6 +548,7 @@ const SquaresModule = ({ sq_comp_id, info_header, view_mode, insets, player_id,
|
|
|
512
548
|
)
|
|
513
549
|
case 'board':
|
|
514
550
|
if(!squares_competition){ return <></> }
|
|
551
|
+
if(squares_competition.status == 'pending'){ return <></> }
|
|
515
552
|
return (
|
|
516
553
|
<View style={{ alignItems:view_mode == 'desktop' ? 'center': undefined }}>
|
|
517
554
|
<SquaresBoard
|
|
@@ -27,6 +27,14 @@ const SquaresManagerApi = {
|
|
|
27
27
|
return []
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
deleteCompetition: async(sq_comp_id:string):Promise<SquaresCompetitionProps|undefined> => {
|
|
31
|
+
try {
|
|
32
|
+
const resp = await axios.post(`${TP_SVC_API}/v1/squares/competition/delete`, { sq_comp_id });
|
|
33
|
+
return resp.data.squares_competition
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
37
|
+
},
|
|
30
38
|
getEventsByEventIds: async(event_ids:string[]):Promise<EventProps[]> => {
|
|
31
39
|
try {
|
|
32
40
|
if(event_ids.length == 0){ return [] }
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react"
|
|
|
2
2
|
import { SquaresManagerApi, SquaresManagerHelpers } from "./api";
|
|
3
3
|
import { Button, Text, TextInput, View } from "../Components/Themed";
|
|
4
4
|
import { FlatList, Image, type ViewStyle } from "react-native";
|
|
5
|
-
import type { CompanyProps, EventProps, FocusPositionProps, GroupProps, LeagueProps, MyPlayerProps, SquaresCompetitionProps } from "../types";
|
|
5
|
+
import type { CompanyProps, EventProps, FocusPositionProps, GroupProps, LeagueProps, MyPlayerProps, PlayerSquareProps, SquaresCompetitionProps } from "../types";
|
|
6
6
|
import { useColors } from "../constants/useColors";
|
|
7
7
|
import LeagueSchedule from "../MarketComponents/components/LeagueSchedule";
|
|
8
8
|
import { Icons, Switch, Toggle } from "../Components";
|
|
@@ -10,6 +10,7 @@ import moment from "moment-mini";
|
|
|
10
10
|
import ImageUploader from "../Components/ImageUploader";
|
|
11
11
|
import GroupSelector from "../CompetitionManager/components/GroupSelector";
|
|
12
12
|
import CompanySelector from "../CompetitionManager/components/CompanySelector";
|
|
13
|
+
import { showConfirmAlert } from "../Components/ConfirmAlert";
|
|
13
14
|
|
|
14
15
|
type SquaresManagerProps = {
|
|
15
16
|
sq_comp_id:string,
|
|
@@ -17,12 +18,13 @@ type SquaresManagerProps = {
|
|
|
17
18
|
float?:boolean,
|
|
18
19
|
player?:MyPlayerProps,
|
|
19
20
|
onActivate:(sq:SquaresCompetitionProps) => void,
|
|
21
|
+
onDelete:(sq:SquaresCompetitionProps) => void,
|
|
20
22
|
onClose:() => void,
|
|
21
23
|
header_style?:ViewStyle,
|
|
22
24
|
footer_style?:ViewStyle
|
|
23
25
|
}
|
|
24
|
-
const sections = ['header','toggle','info','event']
|
|
25
|
-
const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPosition, footer_style, onClose, onActivate }:SquaresManagerProps) => {
|
|
26
|
+
const sections = ['header','activate','toggle','info','event','delete']
|
|
27
|
+
const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPosition, footer_style, onDelete, onClose, onActivate }:SquaresManagerProps) => {
|
|
26
28
|
const Colors = useColors();
|
|
27
29
|
const [ my_data, setMyData ] = useState<{
|
|
28
30
|
groups:GroupProps[],
|
|
@@ -34,10 +36,11 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
34
36
|
const { groups, companies } = my_data;
|
|
35
37
|
const [ sq_state, setState ] = useState<{
|
|
36
38
|
loading: boolean,
|
|
37
|
-
active_tab: 'info'|'event',
|
|
39
|
+
active_tab: 'info'|'event'|'danger',
|
|
38
40
|
leagues_visible?:boolean,
|
|
39
41
|
active_event?:EventProps,
|
|
40
42
|
active_league?:LeagueProps,
|
|
43
|
+
player_squares:PlayerSquareProps[],
|
|
41
44
|
min_square_price:string,
|
|
42
45
|
guaranteed_payout:string,
|
|
43
46
|
leagues:LeagueProps[],
|
|
@@ -50,13 +53,13 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
50
53
|
leagues_visible:false,
|
|
51
54
|
leagues:[],
|
|
52
55
|
min_square_price: '0',
|
|
56
|
+
player_squares:[],
|
|
53
57
|
guaranteed_payout: '0',
|
|
54
58
|
league_schedule: false
|
|
55
59
|
});
|
|
56
|
-
const { loading, squares_competition, min_square_price, guaranteed_payout, active_tab, leagues, league_schedule, draft_competition, leagues_visible, active_event, active_league } = sq_state
|
|
60
|
+
const { loading, squares_competition, min_square_price, player_squares, guaranteed_payout, active_tab, leagues, league_schedule, draft_competition, leagues_visible, active_event, active_league } = sq_state
|
|
57
61
|
const active_group = groups.find(g => g.group_id == draft_competition?.group_id)
|
|
58
62
|
const active_company = companies.find(c => c.company_id == draft_competition?.company_id);
|
|
59
|
-
|
|
60
63
|
useEffect(() => {
|
|
61
64
|
SquaresManagerApi.setEnvironment();
|
|
62
65
|
getData(sq_comp_id)
|
|
@@ -93,6 +96,7 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
93
96
|
loading: false,
|
|
94
97
|
leagues: lgs.filter(l => l.sport == 'Football'),
|
|
95
98
|
active_event: active_ev,
|
|
99
|
+
player_squares: sq_data.player_squares,
|
|
96
100
|
min_square_price: sq_data.squares_competition.minimum_square_price.toFixed(2),
|
|
97
101
|
active_league: active_league,
|
|
98
102
|
draft_competition: sq_data.squares_competition,
|
|
@@ -114,6 +118,27 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
114
118
|
onActivate(activate_resp.squares_competition)
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
const handleDelete = async() => {
|
|
122
|
+
setState({ ...sq_state, loading:true });
|
|
123
|
+
const deleted_comp = await SquaresManagerApi.deleteCompetition(sq_comp_id);
|
|
124
|
+
if(!deleted_comp){ return alert('Unable to delete competition. If any bids are active, you cannot delete this competition') }
|
|
125
|
+
setState({
|
|
126
|
+
...sq_state,
|
|
127
|
+
squares_competition: deleted_comp,
|
|
128
|
+
draft_competition: deleted_comp,
|
|
129
|
+
loading:true
|
|
130
|
+
});
|
|
131
|
+
onDelete(deleted_comp)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const handleConfirmDelete = () => {
|
|
135
|
+
if(player_squares.length > 0){ return alert('Unable to delete competition with active bids') }
|
|
136
|
+
showConfirmAlert('Are you sure?', 'Once this is deleted you can no longer access it',
|
|
137
|
+
() => handleDelete(),
|
|
138
|
+
() => console.log('')
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
117
142
|
const updateCompetition = async(sq_comp:SquaresCompetitionProps) => {
|
|
118
143
|
if(errors.length > 0){ return alert(errors.map(e => e)) }
|
|
119
144
|
if(loading){ return }//No mashy
|
|
@@ -189,6 +214,24 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
189
214
|
/>
|
|
190
215
|
</View>
|
|
191
216
|
)
|
|
217
|
+
case 'activate':
|
|
218
|
+
if(squares_competition?.status != 'pending'){ return <></> }
|
|
219
|
+
return (
|
|
220
|
+
<View type='row' style={{ padding:10 }}>
|
|
221
|
+
<View style={{ flex:1 }}>
|
|
222
|
+
<Text theme="h2">Squares competition is pending.</Text>
|
|
223
|
+
<Text theme="description" style={{ marginTop:3 }}>Press Activate to allow others to join!</Text>
|
|
224
|
+
</View>
|
|
225
|
+
<Button
|
|
226
|
+
disabled={errors.length > 0 || loading ? true : false}
|
|
227
|
+
style={{ marginLeft:5, padding:10, opacity: errors.length > 0 ? 0.5: 1 }}
|
|
228
|
+
loading={loading}
|
|
229
|
+
title="ACTIVATE!"
|
|
230
|
+
type='success'
|
|
231
|
+
onPress={() => handleActivate()}
|
|
232
|
+
/>
|
|
233
|
+
</View>
|
|
234
|
+
)
|
|
192
235
|
case 'toggle':
|
|
193
236
|
return (
|
|
194
237
|
<View transparent>
|
|
@@ -199,9 +242,10 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
199
242
|
options={[
|
|
200
243
|
{ key: 'info', label: 'Info', icon: <Icons.MenuIcon size={14} color={Colors.text.warning} /> },
|
|
201
244
|
{ key: 'event', label: 'Event', icon: <Icons.ActivityIcon size={14} color={Colors.text.warning} /> },
|
|
245
|
+
{ key: 'danger', label: 'Danger', icon: <Icons.AlertIcon size={14} color={Colors.text.error} /> },
|
|
202
246
|
]}
|
|
203
247
|
selected_option={active_tab}
|
|
204
|
-
onSelectOption={(key) => setState({ ...sq_state, active_tab: key as 'info'|'event'})}
|
|
248
|
+
onSelectOption={(key) => setState({ ...sq_state, active_tab: key as 'info'|'event'|'danger'})}
|
|
205
249
|
title_renderer={(option) => {
|
|
206
250
|
const selected = option.key == active_tab ? true : false
|
|
207
251
|
return (
|
|
@@ -216,6 +260,33 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
216
260
|
/>
|
|
217
261
|
</View>
|
|
218
262
|
)
|
|
263
|
+
case 'delete':
|
|
264
|
+
if(active_tab != 'danger'){ return <></> }
|
|
265
|
+
return (
|
|
266
|
+
<View>
|
|
267
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
268
|
+
<View transparent style={{ flex:1 }}>
|
|
269
|
+
<Text theme="h1">DELETE COMPETITION</Text>
|
|
270
|
+
<Text theme="description" style={{ marginTop:3 }}>Archive this competition</Text>
|
|
271
|
+
</View>
|
|
272
|
+
</View>
|
|
273
|
+
<View style={{ padding:10 }}>
|
|
274
|
+
{player_squares.length > 0 ?
|
|
275
|
+
<Text theme="warning">This competition cannot be archived as there are active bids on squares.</Text>
|
|
276
|
+
:
|
|
277
|
+
<Text theme="warning">Once archived you will no longer be able to edit or see this competition</Text>
|
|
278
|
+
}
|
|
279
|
+
<Button
|
|
280
|
+
title="DELETE"
|
|
281
|
+
disabled={player_squares.length > 0 ? true: false}
|
|
282
|
+
loading={loading}
|
|
283
|
+
onPress={() => handleConfirmDelete()}
|
|
284
|
+
type='error'
|
|
285
|
+
style={{ marginTop:10, opacity: player_squares.length > 0 || loading ? 0.5:1 }}
|
|
286
|
+
/>
|
|
287
|
+
</View>
|
|
288
|
+
</View>
|
|
289
|
+
)
|
|
219
290
|
case 'info':
|
|
220
291
|
if(!draft_competition){ return <></> }
|
|
221
292
|
if(active_tab != 'info'){ return <></> }
|
|
@@ -392,16 +463,6 @@ const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPositi
|
|
|
392
463
|
type='action'
|
|
393
464
|
onPress={() => draft_competition ? updateCompetition(draft_competition) : console.log('')}
|
|
394
465
|
/>
|
|
395
|
-
{squares_competition?.status == 'pending' ?
|
|
396
|
-
<Button
|
|
397
|
-
disabled={errors.length > 0 || loading ? true : false}
|
|
398
|
-
style={{ flex:2, marginLeft:10, opacity: errors.length > 0 ? 0.5: 1 }}
|
|
399
|
-
loading={loading}
|
|
400
|
-
title="ACTIVATE!"
|
|
401
|
-
type='success'
|
|
402
|
-
onPress={() => handleActivate()}
|
|
403
|
-
/>
|
|
404
|
-
:<></>}
|
|
405
466
|
</View>
|
|
406
467
|
</View>
|
|
407
468
|
)
|