• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CaptainFact / captain-fact-frontend / 13509561802

24 Feb 2025 10:56PM UTC coverage: 5.504% (-1.4%) from 6.953%
13509561802

push

github

web-flow
Release (#1375)

* chore(deps-dev): Bump @babel/preset-env from 7.20.2 to 7.26.9 (#1371)

Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.20.2 to 7.26.9.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.26.9/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Misc styles & GraphQL fixes (#1374)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

43 of 1647 branches covered (2.61%)

Branch coverage included in aggregate %.

192 of 2623 relevant lines covered (7.32%)

0.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/components/Modal/ModalFormContainer.jsx
1
import isPromise from 'is-promise'
2
import React from 'react'
3
import { withTranslation } from 'react-i18next'
4
import { connect } from 'react-redux'
5

6
import { cn } from '@/lib/css-utils'
7

8
import { handleFormEffectResponse } from '../../lib/handle_effect_response'
9
import { popModal } from '../../state/modals/reducer'
10
import { Button } from '../ui/button'
11
import Modal from './Modal'
12

13
@withTranslation('main')
14
@connect(null, { popModal })
15
export class ModalFormContainer extends React.PureComponent {
16
  constructor(props) {
17
    super(props)
×
18
    this.state = { isSubmitting: false }
×
19
    this.close = this.close.bind(this)
×
20
    this.formRef = React.createRef()
×
21
  }
22

23
  handleSubmit(submitFunc) {
24
    return (data) => {
×
25
      const promise = submitFunc(data)
×
26
      if (isPromise(promise)) {
×
27
        this.setState({ isSubmitting: true })
×
28
        return promise.then(
×
29
          handleFormEffectResponse({
30
            onSuccess: () => this.props.popModal(),
×
31
            onError: () => this.setState({ isSubmitting: false }),
×
32
          }),
33
        )
34
      }
35
    }
36
  }
37

38
  close() {
39
    if (this.props.handleAbort) {
×
40
      this.props.handleAbort()
×
41
    }
42
    this.props.popModal()
×
43
  }
44

45
  renderFormButtons() {
46
    const isSubmitting = this.props.isSubmitting || this.state.isSubmitting
×
47
    return (
×
48
      <div className="flex justify-end gap-2">
49
        <Button
50
          type="submit"
51
          disabled={isSubmitting || this.props.confirmLoading || this.props.confirmDisabled}
×
52
          loading={isSubmitting || this.props.confirmLoading}
×
53
          onClick={() => this.formRef.current?.submit()}
×
54
          variant="destructive"
55
        >
56
          <div>{this.props.confirmText || this.props.t('actions.save')}</div>
×
57
        </Button>
58
        <Button type="reset" variant="outline" disabled={isSubmitting} onClick={this.close}>
59
          <div>{this.props.t('actions.cancel')}</div>
60
        </Button>
61
      </div>
62
    )
63
  }
64

65
  render() {
66
    const { FormComponent, handleConfirm, className, formProps = {}, ...modalParams } = this.props
×
67
    return (
×
68
      <Modal
69
        {...modalParams}
70
        handleCloseClick={this.close}
71
        className={cn('modal-form', className)}
72
        footer={this.renderFormButtons()}
73
      >
74
        <FormComponent
75
          ref={this.formRef}
76
          {...formProps}
77
          onSubmit={this.handleSubmit(handleConfirm)}
78
        />
79
      </Modal>
80
    )
81
  }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc