All files / components/Nav Footer.jsx

100% Statements 8/8
100% Branches 2/2
100% Functions 5/5
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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      24x     384x 384x   384x                                                                                         4x             1x                                     1x                       1x                        
import { useState } from "react";
import { Button, Container, Modal } from "react-bootstrap";
 
export const space = " ";
 
export default function Footer({ systemInfo }) {
  const feedbackUrl = systemInfo?.appFeedbackUrl;
  const [showFeedbackModal, setShowFeedbackModal] = useState(false);
 
  return (
    <footer className="bg-dark pt-3 pt-md-4 pb-4 pb-md-5" data-testid="Footer">
      <Container>
        This app is a class project of{" "}
        <a
          data-testid="footer-class-website-link"
          href="https://ucsb-cs156.github.io"
          target="_blank"
          rel="noopener noreferrer"
        >
          CMPSC 156
        </a>{" "}
        at{" "}
        <a
          data-testid="footer-ucsb-link"
          href="https://ucsb.edu"
          target="_blank"
          rel="noopener noreferrer"
        >
          UCSB
        </a>
        . Check out the source code on{" "}
        <a
          data-testid="footer-source-code-link"
          href={"https://github.com/ucsb-cs156/proj-dining"}
          target="_blank"
          rel="noopener noreferrer"
        >
          GitHub
        </a>
        ! This is not an official source of UCSB dining commons information. An
        official source can be found{" "}
        <a
          data-testid="footer-dining-search-link"
          href="https://apps.dining.ucsb.edu/menu/day"
          target="_blank"
          rel="noopener noreferrer"
        >
          here
        </a>
        .{" "}
        {feedbackUrl && (
          <>
            <Button
              data-testid="footer-feedback-button"
              onClick={() => setShowFeedbackModal(true)}
              variant="primary"
            >
              Provide Feedback
            </Button>
            <Modal
              show={showFeedbackModal}
              onHide={() => setShowFeedbackModal(false)}
              animation={false}
              data-testid="footer-feedback-modal"
            >
              <Modal.Header closeButton>
                <Modal.Title>Provide Feedback</Modal.Title>
              </Modal.Header>
              <Modal.Body>
                <p>
                  Users with a UCSB Google Account are welcome to leave feedback
                  and make suggestions for improvements and new features. If the
                  following link doesn&apos;t work, try logging into your UCSB
                  Email/Google account in this browser first, and then try the
                  link again.
                </p>
              </Modal.Body>
              <Modal.Footer>
                <Button
                  variant="secondary"
                  onClick={() => setShowFeedbackModal(false)}
                  data-testid="footer-feedback-modal-close-button"
                >
                  Cancel
                </Button>
                <Button
                  as="a"
                  data-testid="footer-feedback-modal-link"
                  href={feedbackUrl}
                  rel="noopener noreferrer"
                  target="_blank"
                  variant="primary"
                  onClick={() => setShowFeedbackModal(false)}
                >
                  Open Feedback Form
                </Button>
              </Modal.Footer>
            </Modal>
          </>
        )}
      </Container>
    </footer>
  );
}