Skip to content

Commit edebf67

Browse files
authored
Merge pull request #279 from php-school/home-page-copy
Update some copy, reimplement slack invite
2 parents e8d0d22 + e555a93 commit edebf67

File tree

25 files changed

+1108
-749
lines changed

25 files changed

+1108
-749
lines changed

.docker/files/php-school-fpm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.1-fpm AS prod
1+
FROM php:8.3-fpm AS prod
22

33
RUN apt-get -qq update && apt-get install -qqy git zlib1g-dev libzip-dev \
44
&& rm -rf /var/lib/apt/lists/* \

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php: [8.1, 8.2]
15+
php: [8.2, 8.3]
1616

1717
name: PHP ${{ matrix.php }}
1818
steps:

app/config.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
use PhpSchool\Website\Action\Online\ComposerPackageAdd;
4545
use PhpSchool\Website\Action\Online\RunExercise;
4646
use PhpSchool\Website\Action\Online\VerifyExercise;
47+
use PhpSchool\Website\Action\SlackInvite;
4748
use PhpSchool\Website\Action\StudentLogin;
4849
use PhpSchool\Website\Action\SubmitWorkshop;
4950
use PhpSchool\Website\Action\TrackDownloads;
@@ -232,14 +233,21 @@
232233
SubmitWorkshop::class => \DI\factory(function (ContainerInterface $c): SubmitWorkshop {
233234
return new SubmitWorkshop(
234235
$c->get(FormHandlerFactory::class)->create(
235-
new SubmitWorkshopInputFilter(new Client, $c->get(WorkshopRepository::class))
236+
new SubmitWorkshopInputFilter(new Client(), $c->get(WorkshopRepository::class))
236237
),
237-
new WorkshopCreator(new WorkshopComposerJsonInputFilter, $c->get(WorkshopRepository::class)),
238+
new WorkshopCreator(new WorkshopComposerJsonInputFilter(), $c->get(WorkshopRepository::class)),
238239
$c->get(EmailNotifier::class),
239240
$c->get(LoggerInterface::class)
240241
);
241242
}),
242243

244+
SlackInvite::class => function (ContainerInterface $c): SlackInvite {
245+
return new SlackInvite(
246+
$c->get('guzzle'),
247+
$c->get('config')['slackInviteApiToken']
248+
);
249+
},
250+
243251
Github::class => function (ContainerInterface $c): Github {
244252
return new Github([
245253
'clientId' => $c->get('config')['github']['clientId'],
@@ -320,6 +328,10 @@
320328
);
321329
},
322330

331+
'guzzle' => function (ContainerInterface $c): \GuzzleHttp\Client {
332+
return new \GuzzleHttp\Client();
333+
},
334+
323335
'guzzle.packagist' => function (ContainerInterface $c) {
324336
return new \GuzzleHttp\Client(['headers' => ['User-Agent' => 'PHP School: phpschool.team@gmail.com']]);
325337
},
@@ -618,7 +630,8 @@ public function parse($markdown): string
618630
'clientSecret' => $_ENV['GITHUB_CLIENT_SECRET'],
619631
],
620632

621-
'jwtSecret' => $_ENV['JWT_SECRET']
633+
'jwtSecret' => $_ENV['JWT_SECRET'],
634+
'slackInviteApiToken' => $_ENV['SLACK_INVITE_API_TOKEN'],
622635
],
623636

624637
//slim settings

assets/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const docRoutes = [].concat(
6060

6161
const routes = [
6262
{ path: "/", component: Home, meta: { layout: MainLayout } },
63-
{ path: "/online", component: Dashboard, meta: { layout: CompactLayout } },
63+
{ path: "/online/:workshop?", component: Dashboard, meta: { layout: CompactLayout } },
6464
{
6565
path: "/online/editor/:workshop/:exercise",
6666
component: ExerciseEditor,

assets/components/Online/ExerciseVerify.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ const enableRateLimitError = () => {
3939
};
4040
4141
const runSolution = async () => {
42-
currentAction.value = "run";
43-
4442
if (loadingRun.value) {
4543
return;
4644
}
@@ -81,8 +79,6 @@ const runSolution = async () => {
8179
};
8280
8381
const verifySolution = () => {
84-
currentAction.value = "verify";
85-
8682
if (loadingVerify.value) {
8783
return;
8884
}
@@ -183,16 +179,25 @@ const verifySolution = () => {
183179
>
184180
<MenuItems class="absolute -right-3 -top-2 z-40 w-[168px] origin-top-right -translate-y-full rounded-md bg-gradient-to-r from-pink-600 to-purple-500 px-3 text-left">
185181
<MenuItem v-if="currentAction === 'verify'">
186-
<button class="flex h-[48px] w-full flex-1 items-center justify-start rounded px-4 text-sm text-white" @click.stop="runSolution" :disabled="loadingRun">
182+
<button
183+
@click.stop="
184+
currentAction = 'run';
185+
runSolution();
186+
"
187+
class="flex h-[48px] w-full flex-1 items-center justify-start rounded px-4 text-sm text-white"
188+
:disabled="loadingRun"
189+
>
187190
<span>Run</span>
188191
<CommandLineIcon class="ml-2 h-5 w-5" />
189192
</button>
190193
</MenuItem>
191194
<MenuItem v-if="currentAction === 'run'">
192195
<button
193-
v-if="currentAction === 'run'"
196+
@click.stop="
197+
currentAction = 'verify';
198+
verifySolution();
199+
"
194200
class="flex h-[48px] w-full flex-1 items-center justify-start rounded px-4 text-sm text-white"
195-
@click.stop="verifySolution"
196201
:disabled="loadingVerify"
197202
>
198203
<span>Verify</span>

assets/components/Online/WorkshopExerciseSelectionList.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,41 @@
22
import { CheckCircleIcon, CommandLineIcon } from "@heroicons/vue/24/solid";
33
import { ArrowRightCircleIcon } from "@heroicons/vue/24/outline";
44
import ExerciseEntry from "./ExerciseEntry.vue";
5-
import { ref } from "vue";
5+
import { ref, watch } from "vue";
66
import Alert from "./SiteAlert.vue";
77
88
import { useStudentStore } from "../../stores/student";
99
const studentStore = useStudentStore();
1010
1111
import { useWorkshopStore } from "../../stores/workshops";
12+
import { useRoute } from "vue-router";
1213
const workshopStore = useWorkshopStore();
1314
1415
const selectedWorkshop = ref(null);
1516
1617
const showNotLoggedInError = ref(false);
1718
19+
const route = useRoute();
20+
1821
const notLoggedIn = () => {
1922
showNotLoggedInError.value = true;
2023
};
2124
2225
const selectWorkshop = (workshopCode) => {
2326
selectedWorkshop.value = workshopStore.workshops.find((workshop) => workshop.code === workshopCode);
27+
28+
history.pushState({}, null, "/online/" + workshopCode);
2429
};
30+
31+
watch(
32+
() => route.params,
33+
(toParams) => {
34+
if (toParams.workshop) {
35+
selectedWorkshop.value = workshopStore.workshops.find((workshop) => workshop.code === toParams.workshop);
36+
}
37+
},
38+
{ immediate: true },
39+
);
2540
</script>
2641

2742
<template>

assets/components/Website/Docs/BundledCheck.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ defineProps({
1212
compatible: {
1313
type: Array,
1414
validator(value) {
15-
return ["CLI, CGI"].includes(value);
15+
return value.every((v) => ["CLI", "CGI"].includes(v));
1616
},
17+
default: () => ["CLI", "CGI"],
1718
},
1819
registered: {
1920
type: Boolean,

assets/components/Website/Docs/DocTitle.vue

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup>
22
import { computed } from "vue";
3+
import { PencilSquareIcon } from "@heroicons/vue/24/outline";
34
45
const props = defineProps({
56
id: {
@@ -24,38 +25,15 @@ const slug = computed(() => {
2425
<template>
2526
<h2 :id="id" class="relative mb-4 flex items-center border-b border-gray-600 pb-1 pt-2 font-mono text-2xl">
2627
<span class="text-[#e91e63]">{{ title }}</span>
27-
<a class="ml-2 inline-block !text-gray-300 hover:!text-gray-200 hover:underline" :href="'#' + slug">#</a>
28+
<a class="ml-2 inline-block !text-gray-300 hover:text-gray-200 hover:underline" :href="'#' + slug">#</a>
2829
<a
2930
v-if="file"
3031
title="Edit this page on GitHub!"
3132
target="_blank"
32-
class="ml-2 inline-block fill-current !text-gray-300 hover:!text-gray-200"
33+
class="ml-2 inline-block fill-current !text-gray-300 hover:!text-[#e91e63]"
3334
:href="'https://www.github.com/php-school/phpschool.io/tree/master/assets/components/Website/Docs/Sections/' + file"
3435
>
35-
<svg
36-
class="h-4 w-4"
37-
version="1.1"
38-
id="Capa_1"
39-
xmlns="http://www.w3.org/2000/svg"
40-
xmlns:xlink="http://www.w3.org/1999/xlink"
41-
x="0px"
42-
y="0px"
43-
width="612px"
44-
height="612px"
45-
viewBox="0 0 612 612"
46-
style="enable-background: new 0 0 612 612"
47-
xml:space="preserve"
48-
>
49-
<g>
50-
<g id="New_x5F_Post">
51-
<g>
52-
<path
53-
d="M545.062,286.875c-15.854,0-28.688,12.852-28.688,28.688v239.062h-459v-459h239.062c15.854,0,28.688-12.852,28.688-28.688S312.292,38.25,296.438,38.25H38.25C17.136,38.25,0,55.367,0,76.5v497.25C0,594.883,17.136,612,38.25,612H535.5c21.114,0,38.25-17.117,38.25-38.25V315.562C573.75,299.727,560.917,286.875,545.062,286.875z M605.325,88.95L523.03,6.655C518.556,2.18,512.684,0,506.812,0s-11.743,2.18-16.218,6.675l-318.47,318.45v114.75h114.75l318.45-318.45c4.494-4.495,6.675-10.366,6.675-16.237C612,99.297,609.819,93.445,605.325,88.95z M267.75,382.5H229.5v-38.25L506.812,66.938l38.25,38.25L267.75,382.5z"
54-
/>
55-
</g>
56-
</g>
57-
</g>
58-
</svg>
36+
<PencilSquareIcon class="h-5 w-5"></PencilSquareIcon>
5937
</a>
6038
<a href="#app" class="absolute right-0 text-xs hover:underline">^ TOP</a>
6139
</h2>

assets/components/Website/Docs/Sections/Tutorial/TutorialHome.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ import ContentHeader from "../../ContentHeader.vue";
1414

1515
<ContentHeader id="tutorial-sections">Tutorial Sections</ContentHeader>
1616

17-
<h3>
17+
<h3 class="mb-2">
1818
<router-link to="/docs/tutorial/creating-your-own-workshop">1. Creating your own workshop</router-link>
1919
</h3>
2020
<p>Learn how to create and setup your very own workshop.</p>
21-
<h3>
21+
<h3 class="mb-2">
2222
<router-link to="/docs/tutorial/modify-theme">2. Modifying the theme of your workshop</router-link>
2323
</h3>
2424
<p>Customise the look and feel of your workshop, personalise to your brand or subject.</p>
25-
<h3>
25+
<h3 class="mb-2">
2626
<router-link to="/docs/tutorial/creating-an-exercise">3. Creating an exercise</router-link>
2727
</h3>
2828
<p>Create the first exercise for your workshop.</p>

assets/components/Website/Docs/contents.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const docs = [
2929
path: "",
3030
title: "Documentation Home",
3131
component: DocHome,
32-
file: "Index.vue",
32+
file: "DocHome.vue",
3333
},
3434
],
3535
},
@@ -41,7 +41,7 @@ const docs = [
4141
path: "",
4242
title: "Workshop Tutorial",
4343
component: TutorialHome,
44-
file: "Tutorial/Index.vue",
44+
file: "Tutorial/TutorialHome.vue",
4545
},
4646
{
4747
path: "creating-your-own-workshop",
@@ -71,7 +71,7 @@ const docs = [
7171
path: "",
7272
title: "Reference Documentation",
7373
component: ReferenceHome,
74-
file: "Reference/Index.vue",
74+
file: "Reference/ReferenceHome.vue",
7575
},
7676
{
7777
path: "container",
@@ -101,7 +101,7 @@ const docs = [
101101
path: "results",
102102
title: "Results & Renderers",
103103
component: Results,
104-
file: "Reference/Results.vue",
104+
file: "Reference/CheckResults.vue",
105105
},
106106
{
107107
path: "exercise-checks",
@@ -137,7 +137,7 @@ const docs = [
137137
path: "events",
138138
title: "Events",
139139
component: Events,
140-
file: "Reference/Events.vue",
140+
file: "Reference/ExerciseEvents.vue",
141141
},
142142
{
143143
path: "creating-listener-checks",

0 commit comments

Comments
 (0)