Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Redirect to learning #2207

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ jobs:
- name: Build
run: npm run build

- name: Cypress tests
uses: cypress-io/github-action@v2
with:
start: npm start
wait-on: "http://localhost:8080/health"
# - name: Cypress tests
# uses: cypress-io/github-action@v2
# with:
# start: npm start
# wait-on: "http://localhost:8080/health"

# We remove the Dockerfile because when there is a Dockerfile in the
# current directory, Google App Engine try to use it.
Expand Down
6 changes: 4 additions & 2 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { LOCALES, translate } from '@mathigon/studio/server/utilities/i18n'
import { generateMockData } from './populate-database'

import {
CONFIG, NOTATIONS, TEXTBOOK_HOME, LEARNING_HOME, LATEST_TEXTBOOK_VERSION, TRANSLATIONS, UNIVERSAL_NOTATIONS, LEARNING_REDIRECTS,
CONFIG, NOTATIONS, TEXTBOOK_HOME, LEARNING_HOME, LATEST_TEXTBOOK_VERSION, TRANSLATIONS, UNIVERSAL_NOTATIONS, LEARNING_REDIRECTS, GITHUB_REDIRECTS, SYLLABI_REDIRECTS,
findNextSection, findPrevSection, getSectionIndex, isLearningPath,
updateGlossary, loadLocaleRawFile, tocFilterByType, removeVersionPrefix
} from './utilities'
Expand Down Expand Up @@ -139,7 +139,9 @@ const start = () => {
.redirects({
'/': LEARNING_HOME,
'/textbook': LEARNING_HOME,
...LEARNING_REDIRECTS
...LEARNING_REDIRECTS,
...GITHUB_REDIRECTS,
...SYLLABI_REDIRECTS
})
.get('/locales/:locale', (req, res) => {
const translations = TRANSLATIONS[req.params.locale || 'en'] || {}
Expand Down
48 changes: 48 additions & 0 deletions server/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { IS_PRODUCTION } from './configuration'

const TEXTBOOK_HOME = 'https://qiskit.org/learn'
const LEARNING_HOME = 'https://learning.quantum.ibm.com'
const TEXTBOOK_GITHUB = 'https://github.com/Qiskit/textbook/tree/main/notebooks'
const BOX_URL = 'https://ibm.box.com/'

const LEARNING_REDIRECTS = {
'/course/algorithm-design': `${LEARNING_HOME}/course/variational-algorithm-design`,
Expand All @@ -35,6 +37,50 @@ const LEARNING_REDIRECTS = {
'/course/algorithms/*': `${LEARNING_HOME}/course/fundamentals-of-quantum-algorithms`
}

const GITHUB_REDIRECTS = {
'/v1/*': 'https://github.com/Qiskit/textbook/tree/maintenance/v1.x',
'/course/introduction': `${TEXTBOOK_GITHUB}/intro`,
'/course/introduction/*': `${TEXTBOOK_GITHUB}/intro`,
'/course/machine-learning': `${TEXTBOOK_GITHUB}/quantum-machine-learning`,
'/course/machine-learning/*': `${TEXTBOOK_GITHUB}/quantum-machine-learning`,
'/course/ch-prerequisites': `${TEXTBOOK_GITHUB}/ch-prerequisites`,
'/course/ch-prerequisites/*': `${TEXTBOOK_GITHUB}/ch-prerequisites`,
'/course/ch-states': `${TEXTBOOK_GITHUB}/ch-states`,
'/course/ch-states/*': `${TEXTBOOK_GITHUB}/ch-states`,
'/course/ch-gates': `${TEXTBOOK_GITHUB}/ch-gates`,
'/course/ch-gates/*': `${TEXTBOOK_GITHUB}/ch-gates`,
'/course/ch-algorithms': `${TEXTBOOK_GITHUB}/ch-algorithms`,
'/course/ch-algorithms/*': `${TEXTBOOK_GITHUB}/ch-algorithms`,
'/course/quantum-hardware-pulses': `${TEXTBOOK_GITHUB}/quantum-hardware-pulses`,
'/course/quantum-hardware-pulses/*': `${TEXTBOOK_GITHUB}/quantum-hardware-pulses`,
'/course/quantum-hardware': `${TEXTBOOK_GITHUB}/quantum-hardware`,
'/course/quantum-hardware/*': `${TEXTBOOK_GITHUB}/quantum-hardware`,
'/course/ch-applications': `${TEXTBOOK_GITHUB}/ch-applications`,
'/course/ch-applications/*': `${TEXTBOOK_GITHUB}/ch-applications`,
'/course/ch-labs': `${TEXTBOOK_GITHUB}/ch-labs`,
'/course/ch-labs/*': `${TEXTBOOK_GITHUB}/ch-labs`,
'/course/ch-demos': `${TEXTBOOK_GITHUB}/ch-demos`,
'/course/ch-demos/*': `${TEXTBOOK_GITHUB}/ch-demos`,
'/course/ch-appendix': `${TEXTBOOK_GITHUB}/ch-appendix`,
'/course/ch-appendix/*': `${TEXTBOOK_GITHUB}/ch-appendix`
}

const SYLLABI_REDIRECTS = {
'/syllabus/7E7-8CC': `${BOX_URL}v/qcprereqmath`,
'/syllabus/SFH-RXE': `${BOX_URL}v/qe23-captain-82`,
'/syllabus/BMK-Q8E': `${BOX_URL}v/qe23-navigator-56`,
'/syllabus/W7V-S2R': `${BOX_URL}v/qe23-traveler-48`,
'/syllabus/AFC-XW1': `${BOX_URL}v/qe23-combatant-23`,
'/syllabus/8N1-ZGF': `${BOX_URL}s/0yenwa0ihnj62au3glzjxralrd3mogtd`,
'/syllabus/TVP-NSE': `${BOX_URL}s/3wkgjcbf4w6zgxq8el52g8q21y4jgpej`,
'/syllabus/47X-43S': `${BOX_URL}s/0g893xv62s36rb9i92amccmxx8ps8mzy`,
'/syllabus/WUB-DCY': `${BOX_URL}s/nhzysimhfpv20l3hwgcyro08d7rhrioj`,
'/syllabus/ESZ-6NJ': `${BOX_URL}s/2s8wu5nvgydhf1eyp5hu06r5p1ogom9j`,
'/syllabus/8XH-8Q9': `${BOX_URL}s/v4v4qeth0vaj05toeqqss6itbiki9wn6`,
'/syllabus/P6J-QPD': `${BOX_URL}s/4dscrgx5hjn55mq861euq3026kl3em8x`,
'/syllabus/LDZ-XN1': `${BOX_URL}s/26v8fkcc7wn9wkyatkfsje7yvj7nochv`
}

// NOTE: if changing this also update the same variable in 'converter/common.ts'
const LATEST_TEXTBOOK_VERSION = 'v2'

Expand Down Expand Up @@ -194,6 +240,8 @@ export {
UNIVERSAL_NOTATIONS,
TOC,
LEARNING_REDIRECTS,
GITHUB_REDIRECTS,
SYLLABI_REDIRECTS,
findNextSection,
findPrevSection,
getSectionIndex,
Expand Down
Loading