Changeset 4f2900a


Ignore:
Timestamp:
02/20/26 00:11:25 (5 months ago)
Author:
Mihail <mihail2.naumov@…>
Branches:
main
Children:
9d40151
Parents:
d07d68c
Message:

Fixed build review

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/dashboard/admin/+Page.tsx

    rd07d68c r4f2900a  
    4141        buildName: string
    4242    }>({open: false, buildId: null, buildName: ''});
    43     const [rejectReason, setRejectReason] = useState('');
    4443    const [approvalLoading, setApprovalLoading] = useState(false);
    4544
     
    7675    const openBuildApproval = (buildId: number, buildName: string) => {
    7776        setBuildApprovalDialog({open: true, buildId, buildName});
    78         setRejectReason('');
    7977    };
    8078
     
    9391    };
    9492
    95     const handleRejectBuild = async () => {
    96         if (!buildApprovalDialog.buildId || !rejectReason.trim()) return;
    97         setApprovalLoading(true);
    98         try {
    99             await onSetBuildApprovalStatus({
    100                 buildId: buildApprovalDialog.buildId,
    101                 isApproved: false,
    102             });
    103             setBuildApprovalDialog({open: false, buildId: null, buildName: ''});
    104             loadData();
    105         } catch (e) {
    106             console.error("Reject error:", e); // 🔧 add this
    107             alert("Reject failed");
    108         } finally {
    109             setApprovalLoading(false);
    110         }
    111     };
     93    // const handleRejectBuild = async () => {
     94    //     if (!buildApprovalDialog.buildId || !rejectReason.trim()) return;
     95    //     setApprovalLoading(true);
     96    //     try {
     97    //         await onSetBuildApprovalStatus({
     98    //             buildId: buildApprovalDialog.buildId,
     99    //             isApproved: false,
     100    //         });
     101    //         setBuildApprovalDialog({open: false, buildId: null, buildName: ''});
     102    //         loadData();
     103    //     } catch (e) {
     104    //         console.error("Reject error:", e); // 🔧 add this
     105    //         alert("Reject failed");
     106    //     } finally {
     107    //         setApprovalLoading(false);
     108    //     }
     109    // };
    112110
    113111    const openSuggestionReview = (id: number, action: 'approved' | 'rejected') => {
     
    456454                        Build ID: {buildApprovalDialog.buildId}
    457455                    </Typography>
    458                     <TextField
    459                         fullWidth
    460                         multiline
    461                         rows={2}
    462                         label="Reject reason (optional)"
    463                         value={rejectReason}
    464                         onChange={(e) => setRejectReason(e.target.value)}
    465                         placeholder="Why reject this build?"
    466                         sx={{mt: 1}}
    467                     />
     456                    {/*<TextField*/}
     457                    {/*    fullWidth*/}
     458                    {/*    multiline*/}
     459                    {/*    rows={2}*/}
     460                    {/*    label="Reject reason (optional)"*/}
     461                    {/*    value={rejectReason}*/}
     462                    {/*    onChange={(e) => setRejectReason(e.target.value)}*/}
     463                    {/*    placeholder="Why reject this build?"*/}
     464                    {/*    sx={{mt: 1}}*/}
     465                    {/*/>*/}
    468466                </DialogContent>
    469467                <DialogActions>
     
    474472                        Cancel
    475473                    </Button>
    476                     <Button
    477                         onClick={handleRejectBuild}
    478                         variant="outlined"
    479                         color="error"
    480                         disabled={approvalLoading || !rejectReason.trim()}
    481                     >
    482                         {approvalLoading ? <CircularProgress size={20}/> : 'Reject'}
    483                     </Button>
     474                    {/*<Button*/}
     475                    {/*    onClick={handleRejectBuild}*/}
     476                    {/*    variant="outlined"*/}
     477                    {/*    color="error"*/}
     478                    {/*    disabled={approvalLoading || !rejectReason.trim()}*/}
     479                    {/*>*/}
     480                    {/*    {approvalLoading ? <CircularProgress size={20}/> : 'Reject'}*/}
     481                    {/*</Button>*/}
    484482                    <Button
    485483                        onClick={handleApproveBuild}
Note: See TracChangeset for help on using the changeset viewer.