diff --git a/js/packages/repo-quest/src/index.tsx b/js/packages/repo-quest/src/index.tsx
index 216ff95..41c171f 100644
--- a/js/packages/repo-quest/src/index.tsx
+++ b/js/packages/repo-quest/src/index.tsx
@@ -212,8 +212,22 @@ let NewQuest = () => {
-
+
+
+ or
+
+ {
+ if (e.target.checkValidity()) setQuest(e.target.value);
+ else setQuest(undefined);
+ }}
+ pattern="[^\/]+\/.+"
+ />
diff --git a/js/packages/repo-quest/styles/index.css b/js/packages/repo-quest/styles/index.css
index f474b2f..ee43f7e 100644
--- a/js/packages/repo-quest/styles/index.css
+++ b/js/packages/repo-quest/styles/index.css
@@ -26,11 +26,11 @@ code, pre {
border-radius: 8px;
padding: 0.5rem 1rem;
margin: 2rem 0;
-
+
> div {
margin-bottom: 1rem;
}
-
+
.action {
font-weight: bold;
}
@@ -73,7 +73,7 @@ h1 {
}
.help {
- display: inline-block;
+ display: inline-block;
border: 1px solid #ccc;
background: #fafafa;
padding: 3px 5px;
@@ -123,7 +123,7 @@ h1 {
100% {
transform: rotate(360deg);
}
-}
+}
.gh-links a:not(:first-child) {
margin-left: 0.5rem;
@@ -138,9 +138,9 @@ button, input[type=submit] {
appearance: none;
background: #eee;
border: 1px solid #aaa;
- border-radius: 4px;
+ border-radius: 4px;
padding: 3px 5px;
-
+
&:not([disabled]) {
cursor: pointer;
@@ -157,31 +157,41 @@ button, input[type=submit] {
.controls {
display: flex;
- gap: 1rem;
+ gap: 1rem;
}
.new-quest {
display: flex;
flex-direction: column;
- gap: 1rem;
+ gap: 1rem;
table {
width: max-content;
td {
padding-bottom: 0.5rem;
- }
- td:first-child {
- padding-right: 1rem;
- }
+ &:first-child {
+ padding-right: 1rem;
+ }
+
+ input[type=text] {
+ border: 1px solid #ccc;
+ font-size: 80%;
+ width: 300px;
+
+ &:invalid {
+ box-shadow: 0 0 4px red;
+ }
+ }
+ }
}
}
.columns {
display: flex;
justify-content: space-between;
- gap: 2rem;
+ gap: 2rem;
}
.meta {
@@ -212,7 +222,7 @@ button, input[type=submit] {
}
dialog {
- z-index: 1000;
+ z-index: 1000;
max-width: 400px;
box-shadow: 4px 4px 8px #aaa;
diff --git a/rs/crates/repo-quest/src/github.rs b/rs/crates/repo-quest/src/github.rs
index 2d325eb..d7e2df7 100644
--- a/rs/crates/repo-quest/src/github.rs
+++ b/rs/crates/repo-quest/src/github.rs
@@ -110,7 +110,8 @@ impl GithubRepo {
.owner(&self.user)
.private(true)
.send()
- .await?;
+ .await
+ .with_context(|| format!("Failed to clone template repo {}/{}", base.user, base.name))?;
// There is some unknown delay between creating a repo from a template and its contents being added.
// We have to wait until that happens.
diff --git a/rs/crates/repo-quest/src/lib.rs b/rs/crates/repo-quest/src/lib.rs
index f492971..7e8e2f7 100644
--- a/rs/crates/repo-quest/src/lib.rs
+++ b/rs/crates/repo-quest/src/lib.rs
@@ -75,8 +75,11 @@ async fn new_quest(
quest: String,
app: AppHandle,
) -> Result<(QuestConfig, StateDescriptor), String> {
- let config = fmt_err(QuestConfig::load_from_remote("cognitive-engineering-lab", &quest).await)?;
- let quest = load_quest_core(dir.join(quest), &config, app).await?;
+ let (owner, repo) = quest
+ .split_once("/")
+ .ok_or_else(|| format!("Invalid quest name: {quest}"))?;
+ let config = fmt_err(QuestConfig::load_from_remote(owner, repo).await)?;
+ let quest = load_quest_core(dir.join(repo), &config, app).await?;
fmt_err(quest.create_repo().await)?;
let state = fmt_err(quest.state_descriptor().await)?;
Ok((config, state))
diff --git a/rs/crates/repo-quest/src/quest.rs b/rs/crates/repo-quest/src/quest.rs
index 3003d55..bb66461 100644
--- a/rs/crates/repo-quest/src/quest.rs
+++ b/rs/crates/repo-quest/src/quest.rs
@@ -49,7 +49,9 @@ impl QuestConfig {
async fn load_core<'a, Fut: Future