Skip to content

Commit

Permalink
Merge branch 'P2Fancy' of https://github.com/chekjun/cadet-frontend i…
Browse files Browse the repository at this point in the history
…nto P2Fancy
  • Loading branch information
milidieh committed Jun 16, 2021
1 parent 905ae76 commit 031cd15
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 35 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/build-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ jobs:
run: |
yarn install
yarn run build
ln -s index.html build/playground.html
ln -s index.html build/contributors.html
ln -s index.html build/sourcecast.html
ln -s index.html build/interactive-sicp.html
# the `ln`s above are a hack to make GitHub Pages route /playground
# and /contributors etc to index, instead of 404-ing.
env:
REACT_APP_URL_SHORTENER_SIGNATURE: ${{ secrets.REACT_APP_URL_SHORTENER_SIGNATURE }}
REACT_APP_URL_SHORTENER_DOMAIN: ${{ secrets.REACT_APP_URL_SHORTENER_DOMAIN }}
Expand All @@ -60,7 +54,20 @@ jobs:
PUBLIC_URL: "https://source-academy.github.io"
REACT_APP_GITHUB_OAUTH_PROXY_URL: ${{ secrets.REACT_APP_GITHUB_OAUTH_PROXY_URL }}
REACT_APP_GITHUB_CLIENT_ID: ${{ secrets.REACT_APP_GITHUB_CLIENT_ID }}

- name: Create symbolic links
run: |
set -euxo pipefail
ln -s index.html build/playground.html
ln -s index.html build/contributors.html
ln -s index.html build/sourcecast.html
ln -s index.html build/interactive-sicp.html
mkdir -p build/interactive-sicp
declare -a arr=("index" "foreword" "prefaces03" "prefaces84" "prefaces96" "acknowledgements" "1" "1.1" "1.1.1" "1.1.2" "1.1.3" "1.1.4" "1.1.5" "1.1.6" "1.1.7" "1.1.8" "1.2" "1.2.1" "1.2.2" "1.2.3" "1.2.4" "1.2.5" "1.2.6" "1.3" "1.3.1" "1.3.2" "1.3.3" "1.3.4" "2" "2.1" "2.1.1" "2.1.2" "2.1.3" "2.1.4" "2.2" "2.2.1" "2.2.2" "2.2.3" "2.2.4" "2.3" "2.3.1" "2.3.2" "2.3.3" "2.3.4" "2.4" "2.4.1" "2.4.2" "2.4.3" "2.5" "2.5.1" "2.5.2" "2.5.3" "3" "3.1" "3.1.1" "3.1.2" "3.1.3" "3.2" "3.2.1" "3.2.2" "3.2.3" "3.2.4" "3.3" "3.3.1" "3.3.2" "3.3.3" "3.3.4" "3.3.5" "3.4" "3.4.1" "3.4.2" "3.5" "3.5.1" "3.5.2" "3.5.3" "3.5.4" "3.5.5" "4" "4.1" "4.1.1" "4.1.2" "4.1.3" "4.1.4" "4.1.5" "4.1.6" "4.1.7" "4.2" "4.2.1" "4.2.2" "4.2.3" "4.3" "4.3.1" "4.3.2" "4.3.3" "4.4" "4.4.1" "4.4.2" "4.4.3" "4.4.4" "5" "5.1" "5.1.1" "5.1.2" "5.1.3" "5.1.4" "5.1.5" "5.2" "5.2.1" "5.2.2" "5.2.3" "5.2.4" "5.3" "5.3.1" "5.3.2" "5.4" "5.4.1" "5.4.2" "5.4.3" "5.4.4" "5.5" "5.5.1" "5.5.2" "5.5.3" "5.5.4" "5.5.5" "5.5.6" "5.5.7" "references" "making-of")
for i in "${arr[@]}"; do
ln -s ../index.html build/interactive-sicp/$i.html
done
# the `ln`s above are a hack to make GitHub Pages route /playground
# and /contributors etc to index, instead of 404-ing.
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
14 changes: 7 additions & 7 deletions src/pages/githubAssessments/GitHubAssessmentDefaultValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Everything here is written in Markdown.
This means that you can **bolden** or *italicize* text by adding asterisks.
Code-blocks can be formatted through the use of backticks:
Programs can be formatted through the use of triple backticks:
\`\`\`
// This is a code example
// This is a program example
\`\`\`
If you want to in-line code, rather than display a whole code-block, you can also do \`this\`.
If you want to in-line program snippets, rather than display it as a block, you can also use single backticks like \`this\`.
Lists can be created by adding dashes to the start of a line:
- First element
Expand Down Expand Up @@ -48,11 +48,11 @@ Everything here is written in Markdown.
This means that you can **bolden** or *italicize* text by adding asterisks.
Code-blocks can be formatted through the use of backticks:
Programs can be formatted through the use of triple backticks:
\`\`\`
// This is a code example
// This is a program example
\`\`\`
If you want to in-line code, rather than display a whole code-block, you can also do \`this\`.
If you want to in-line program snippets, rather than display it as a block, you can also use single backticks like \`this\`.
Lists can be created by adding dashes to the start of a line:
- First element
Expand All @@ -67,7 +67,7 @@ It is also possible to embed images, like this:
If you need a more detailed cheatsheet, please click [here](https://www.markdownguide.org/cheat-sheet/)!
`;

export const defaultStarterCode = '// Your code here!\n';
export const defaultStarterCode = '// Your program here!\n';

export const defaultMissionMetadata = {
coverImage: '',
Expand Down
25 changes: 4 additions & 21 deletions src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,27 +265,10 @@ const GitHubAssessmentWorkspace: React.FC<GitHubAssessmentWorkspaceProps> = prop
if (octokit === undefined) return;

const missionDataPromise = getMissionData(missionRepoData, octokit);
const isTeacherModePromise = octokit.users
.getAuthenticated()
.then((authenticatedUser: any) => {
const userLogin = authenticatedUser.data.login;
return userLogin === missionRepoData.repoOwner;
})
.then(async (userOwnsRepo: boolean) => {
if (userOwnsRepo) return true;

const userOrganisations = (await octokit.orgs.listForAuthenticatedUser()).data;
let userOrganisationOwnsRepo = false;
for (let i = 0; i < userOrganisations.length; i++) {
const org = userOrganisations[i];
// User has admin access to an organization owning the repo
userOrganisationOwnsRepo = org.login === missionRepoData.repoOwner;
if (userOrganisationOwnsRepo) {
break;
}
}
return userOrganisationOwnsRepo;
});
const isTeacherModePromise = octokit.users.getAuthenticated().then((authenticatedUser: any) => {
const userLogin = authenticatedUser.data.login;
return userLogin === missionRepoData.repoOwner;
});

const promises = [missionDataPromise, isTeacherModePromise];

Expand Down

0 comments on commit 031cd15

Please sign in to comment.