Skip to content

Commit

Permalink
added loading animation when sharing the trip as a link
Browse files Browse the repository at this point in the history
  • Loading branch information
sam9116 committed Dec 12, 2024
1 parent bb18e94 commit 1d2895c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/Odyssey/Odyssey.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Grid, Button, Stack } from "@mui/material";
import React, { useState } from 'react';
import { Grid, Button, Stack, CircularProgress } from "@mui/material";
// Import other components
import SharePage from "./SharePage.js";

Expand Down Expand Up @@ -45,6 +45,7 @@ const Odyssey = ({
setShareId
}) => {
const handleShareAsLink = async function () {
setIsLoading(true);
//gather json for artists, map coordinates, share page schedules, concert list, trip name, map style id, start date, end date
try {

Expand Down Expand Up @@ -92,8 +93,9 @@ const Odyssey = ({
console.log(err);
}
//make a request to taverondemand.azurewebsites.net/api/SaveTrips
setIsLoading(false);
};

const [isLoading, setIsLoading] = useState(false);
return (
<Grid sx={{ container: true, mb: 10 }} >
<div id="sharepage">
Expand All @@ -114,14 +116,15 @@ const Odyssey = ({
direction="column"
alignItems="center"
>
<Button
id="sharelinkbutton"
color="primary"
disabled={concerts.length === 0}
onClick={handleShareAsLink}
variant="contained">
Share As Link
</Button>
{isLoading ? <CircularProgress /> :
<Button
id="sharelinkbutton"
color="primary"
disabled={concerts.length === 0}
onClick={handleShareAsLink}
variant="contained">
Share As Link
</Button>}
</Stack>
</Grid>
);
Expand Down

0 comments on commit 1d2895c

Please sign in to comment.