Skip to content

Commit 771785e

Browse files
committed
Update UI and write index.json file
1 parent eff0bac commit 771785e

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

Diff for: packages/host/app/components/operator-mode/workspace-chooser/add-workspace.gts

+5-7
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,7 @@ export default class AddWorkspace extends Component<Signature> {
140140
@helperText='The endpoint is the unique identifier for your workspace. Use letters, numbers, and hyphens only.'
141141
/>
142142
</FieldContainer>
143-
<FieldContainer
144-
@label='Initialize workspace with'
145-
@tag='label'
146-
class='field'
147-
>
143+
<FieldContainer @label='Copy from Seed' @tag='label' class='field'>
148144
<label class='copy-from-seed-label'>
149145
<BoxelInput
150146
data-test-copy-from-seed-field
@@ -154,7 +150,8 @@ export default class AddWorkspace extends Component<Signature> {
154150
@value={{this.copyFromSeedRealm}}
155151
@onChange={{this.toggleCopyFromSeedRealm}}
156152
/>
157-
<span>Cards and Fields from Seed Workspace</span>
153+
<span>Populate new workspace with sample cards (uncheck for a
154+
blank workspace).</span>
158155
</label>
159156
</FieldContainer>
160157
{{/if}}
@@ -256,8 +253,8 @@ export default class AddWorkspace extends Component<Signature> {
256253
}
257254
.copy-from-seed-label {
258255
display: flex;
259-
align-items: center;
260256
gap: calc(var(--boxel-sp-sm) + 1px);
257+
padding-top: var(--boxel-sp-sm);
261258
}
262259
.copy-from-seed-label span {
263260
color: var(--boxel-label-color);
@@ -267,6 +264,7 @@ export default class AddWorkspace extends Component<Signature> {
267264
.copy-from-seed-label :deep(.input-container) {
268265
grid-template-columns: 1fr;
269266
width: auto;
267+
height: 100%;
270268
}
271269
.copy-from-seed-checkbox {
272270
--boxel-input-height: 17px;

Diff for: packages/realm-server/server.ts

+21-18
Original file line numberDiff line numberDiff line change
@@ -337,26 +337,29 @@ export class RealmServer {
337337
...(iconURL ? { iconURL } : {}),
338338
...(backgroundURL ? { backgroundURL } : {}),
339339
});
340-
if (this.seedPath) {
341-
if (copyFromSeedRealm) {
342-
let ignoreList = IGNORE_SEED_FILES.map((file) =>
343-
join(this.seedPath!.replace(/\/$/, ''), file),
344-
);
340+
if (this.seedPath && copyFromSeedRealm) {
341+
let ignoreList = IGNORE_SEED_FILES.map((file) =>
342+
join(this.seedPath!.replace(/\/$/, ''), file),
343+
);
345344

346-
copySync(this.seedPath, realmPath, {
347-
filter: (src, _dest) => {
348-
return !ignoreList.includes(src);
345+
copySync(this.seedPath, realmPath, {
346+
filter: (src, _dest) => {
347+
return !ignoreList.includes(src);
348+
},
349+
});
350+
this.log.debug(`seed files for new realm ${url} copied to ${realmPath}`);
351+
} else {
352+
writeJSONSync(join(realmPath, 'index.json'), {
353+
data: {
354+
type: 'card',
355+
meta: {
356+
adoptsFrom: {
357+
module: 'https://cardstack.com/base/cards-grid',
358+
name: 'CardsGrid',
359+
},
349360
},
350-
});
351-
this.log.debug(
352-
`seed files for new realm ${url} copied to ${realmPath}`,
353-
);
354-
} else {
355-
copySync(
356-
join(this.seedPath!.replace(/\/$/, ''), 'index.json'),
357-
join(realmPath!.replace(/\/$/, ''), 'index.json'),
358-
);
359-
}
361+
},
362+
});
360363
}
361364

362365
let realm = new Realm(

0 commit comments

Comments
 (0)