forked from RCOSDP/GakuNinLMS-LTI-MC
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from npocccties/feat-support-multiple-lms
複数LMSのサポート
- Loading branch information
Showing
56 changed files
with
853 additions
and
756 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Link from "@material-ui/core/Link"; | ||
import { useLmsUrl } from "$store/session"; | ||
import Problem from "./Problem"; | ||
|
||
export default function TopicNotFoundProblem() { | ||
const url = useLmsUrl(); | ||
|
||
return ( | ||
<Problem title="トピックがありません"> | ||
トピックが見つかりませんでした | ||
{url && ( | ||
<p> | ||
<Link href={url}>LMSに戻る</Link> | ||
</p> | ||
)} | ||
</Problem> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default { title: "organisms/Problem" }; | ||
|
||
import Link from "@material-ui/core/Link"; | ||
import Problem from "./Problem"; | ||
|
||
export const Default = () => ( | ||
<Problem title="ブックが未連携です"> | ||
LTIリンクがどのブックとも連携されていません。担当教員にお問い合わせください | ||
<p> | ||
<Link href="#">LMSに戻る</Link> | ||
</p> | ||
</Problem> | ||
); | ||
|
||
// TODO: Please use <Provider> の問題の回避 | ||
function wrap(WrappedComponent: React.FC) { | ||
function Component() { | ||
return <WrappedComponent />; | ||
} | ||
return Component; | ||
} | ||
|
||
import UnlinkedProblem from "./UnlinkedProblem"; | ||
export const Unlinked = wrap(UnlinkedProblem); | ||
|
||
import BookNotFoundProblem from "./BookNotFoundProblem"; | ||
export const BookNotFound = wrap(BookNotFoundProblem); | ||
|
||
import TopicNotFoundProblem from "./TopicNotFoundProblem"; | ||
export const TopicNotFound = wrap(TopicNotFoundProblem); |
17 changes: 6 additions & 11 deletions
17
components/templates/Unknown.tsx → components/organisms/Problem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
import type { ReactNode } from "react"; | ||
import { makeStyles } from "@material-ui/core/styles"; | ||
import Typography from "@material-ui/core/Typography"; | ||
import Link from "@material-ui/core/Link"; | ||
import Container from "@material-ui/core/Container"; | ||
import useContainerStyles from "styles/container"; | ||
import { NEXT_PUBLIC_LMS_URL } from "$utils/env"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
container: { | ||
marginTop: theme.spacing(4), | ||
}, | ||
})); | ||
|
||
type Props = { header: Node | string; children?: Node | string }; | ||
type Props = { title: ReactNode; children?: ReactNode }; | ||
|
||
export default function Unknown(props: Props) { | ||
export default function Problem(props: Props) { | ||
const classes = useStyles(); | ||
const containerClasses = useContainerStyles(); | ||
const { header, children } = props; | ||
const { title, children } = props; | ||
return ( | ||
<Container | ||
classes={containerClasses} | ||
className={classes.container} | ||
maxWidth="md" | ||
> | ||
<Typography variant="h4" gutterBottom={true}> | ||
{header} | ||
</Typography> | ||
<Typography variant="body1"> | ||
{children} | ||
<br /> | ||
<Link href={NEXT_PUBLIC_LMS_URL}>LMSに戻る</Link> | ||
{title} | ||
</Typography> | ||
<Typography variant="body1">{children}</Typography> | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Link from "@material-ui/core/Link"; | ||
import { useLmsUrl } from "$store/session"; | ||
import Problem from "./Problem"; | ||
|
||
export default function BookNotFoundProblem() { | ||
const url = useLmsUrl(); | ||
|
||
return ( | ||
<Problem title="ブックがありません"> | ||
ブックが見つかりませんでした | ||
{url && ( | ||
<p> | ||
<Link href={url}>LMSに戻る</Link> | ||
</p> | ||
)} | ||
</Problem> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Link from "@material-ui/core/Link"; | ||
import { useLmsUrl } from "$store/session"; | ||
import Problem from "./Problem"; | ||
|
||
export default function UnlinkedProblem() { | ||
const url = useLmsUrl(); | ||
|
||
return ( | ||
<Problem title="ブックが未連携です"> | ||
LTIリンクがどのブックとも連携されていません。担当教員にお問い合わせください | ||
{url && ( | ||
<p> | ||
<Link href={url}>LMSに戻る</Link> | ||
</p> | ||
)} | ||
</Problem> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9a97ec1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: