Skip to content

Commit

Permalink
Merge pull request #12 from snowcamp:auto_dates
Browse files Browse the repository at this point in the history
auto dates
  • Loading branch information
schassande authored Apr 28, 2024
2 parents f11874f + 03c61b7 commit 8c11f26
Show file tree
Hide file tree
Showing 15 changed files with 234 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/components/CFPDates.astro
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const lang = (Astro.locals as any).lang;
<i class="checked calendar icon"></i>
<div class="content">
<div class="title">Snowcamp</div>
<div class="description">{(edition.dates as any)[lang]} {edition.year}</div>
<div class="description">{(edition.dates as any)[lang]}&nbsp;{edition.year}</div>
</div>
</div>
</div>
71 changes: 71 additions & 0 deletions src/components/DateTimeChangingChild.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
const { beginDate, endDate, refreshInterval } = Astro.props;
// generation d'un identifiant de composant
const id = Math.round(Math.random() * 100000);
const beforeId = 'before' + id;
const doingId = 'doing' + id;
const afterId = 'after' + id;
// console.log(beginDate, endDate, refreshInterval, id);
---
<astro-interval-reloader data-genid={id} data-begindate={beginDate} data-enddate={endDate} data-refreshinterval={refreshInterval}>
<span id={beforeId}>
<slot name="before"></slot>
</span>
<span id={doingId}>
<slot name="doing"></slot>
</span>
<span id={afterId}>
<slot name="after"></slot>
</span>
</astro-interval-reloader>

<script>
// Create your custom class for catching the parameter
class IntervalReloader extends HTMLElement {
constructor() {
super();
const beginDate = this.dataset.begindate ? Number.parseInt(this.dataset.begindate, 10) : undefined;
const endDate = this.dataset.enddate ? Number.parseInt(this.dataset.enddate, 10) : undefined;
const refreshInterval = this.dataset.refreshinterval ? Number.parseInt(this.dataset.refreshinterval, 10) : undefined;
const id = this.dataset.genid ? Number.parseInt(this.dataset.genid, 10) : undefined;
// console.log('beginDate', beginDate, 'endDate', endDate, 'refreshInterval', refreshInterval, 'id', id);
if (beginDate) {
this.computeVisibility(''+id, beginDate, endDate);
if (refreshInterval) {
setInterval(() => this.computeVisibility(''+id, beginDate, endDate), refreshInterval);
}
} else {
console.error('No begin date for the component: ', id);
}
}
computeVisibility(id:string, beginDate:number, endDate?:number) {
var now = new Date().getTime();
if (now < beginDate) {
// console.log('Still before', now, beginDate, "\n", new Date(now), "\n", new Date(beginDate));
this.showElement('before'+id);
this.hideElement('doing'+id);
this.hideElement('after'+id);
} else if (endDate && endDate < now) {
// console.log('Closed')
this.hideElement('before'+id);
this.hideElement('doing'+id);
this.showElement('after'+id);
} else {
// console.log('Open')
this.hideElement('before'+id);
this.showElement('doing'+id);
this.hideElement('after'+id);
}
}
showElement(id: string) {
const el = document.getElementById(id);
if (el) el.hidden = false;
}
hideElement(id: string) {
const el = document.getElementById(id);
if (el) el.hidden = true;
}
}

customElements.define('astro-interval-reloader', IntervalReloader);
</script>
2 changes: 1 addition & 1 deletion src/components/Menu.astro
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const path_fr = path.replace('/en/','/');
</div>
</li>
<li class="nav-item"><a class="nav-link" href={url_prefix+'/#program'}>
{ cfp.status !== "published" ? t("program_translation") : t("schedule_translation") }
{ !cfp.published ? t("program_translation") : t("schedule_translation") }
</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href={url_prefix+'/#sponsors'} id="navSponsorsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Expand Down
4 changes: 0 additions & 4 deletions src/components/SponsorFormula.astro
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,5 @@ const { sponsor, cssClass } = Astro.props;
<li><i class="fa fa-check" aria-hidden="true"></i> {t('sponsor_kakemono')}</li>
: ''}
</ul>
<div class="sponsors-form">
<a href={sponsors.sponsorship.prospectus} target="_blank">{t('sponsorship_prospectus')}</a>
</div>
<a class="snc-btn" href="mailto:[email protected]"><span>{t('contact_us')}</span></a>
</div>
</div>
11 changes: 1 addition & 10 deletions src/components/StoreButton.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@ const lang = (Astro.locals as any).lang;
const url = ticket.store.url;
const onclick = "var w=window.open('"+url+"&popup=1','Reserver', 'width=650, height=600, top=100, left=100, toolbar=no, resizable=yes, scrollbars=yes, status=no'); w.focus(); return false";
url + '&popup=1';
let linkName =''
if (store.status === "open") {
linkName = t('store_is_open');
} else if (store.status === "closed") {
linkName = t('store_is_soldout');
} else if ((store.open_date as any)[lang]) {
linkName = t('store_opens_on', (store.open_date as any)[lang]);
} else {
linkName = t('store_not_open');
}
let linkName = t('store_opens_on', (store.open_date as any)[lang]);
---
<a class="snc-btn disabled"
href={url} target="_blank"
Expand Down
10 changes: 9 additions & 1 deletion src/components/StorePackage.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
import StoreButton from "./StoreButton.astro"
import { t } from "../i18n/i18n";
import type { StoreType } from "./store";
import DateTimeChangingChild from "./DateTimeChangingChild.astro";
interface Props {
days: number;
store: StoreType;
}
const { store, days } = Astro.props;
const lang = (Astro.locals as any).lang;
const title = store.title;
const desc = days === 3 ? t('store_package_universities_plus_confs') : t('store_package_confs_only');
const price = days === 3 ? store.price_univ : store.price_conf;
---
<div class="single">
<div class="single-top">
Expand All @@ -26,6 +29,11 @@ const price = days === 3 ? store.price_univ : store.price_conf;
<li><i class="fa fa-check" aria-hidden="true"></i> {t('store_access_lunch', days)}</li>
<li><i class="fa fa-check" aria-hidden="true"></i> {t('store_access_meet_and_greet')}</li>
</ul>
<StoreButton store={store}></StoreButton>

<DateTimeChangingChild beginDate={Date.parse(store.beginDate)} endDate={Date.parse(store.endDate)} refreshInterval="10000">
<span class="snc-btn disabled" slot="before">{t('store_opens_on', (store.open_date as any)[lang])}</span>
<StoreButton store={store} slot="doing"></StoreButton>
<span class="snc-btn disabled" slot="after">{t('store_is_soldout')}</span>
</DateTimeChangingChild>
</div>
</div>
2 changes: 2 additions & 0 deletions src/components/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export interface StoreType {
price_conf: number;
price_univ: number;
status: string;
beginDate: string;
endDate: string;
open_date: {
fr: string;
en: string;
Expand Down
7 changes: 3 additions & 4 deletions src/data/cfp.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

{
"possible_status": [ "not_open", "opens_soon", "open", "closed", "published"],
"status": "opens_soon",
"published" : false,
"url": "",
"year": 2025,
"sched_url": "",
"feedback_url": "",
"dates": {
"open_date": {
"date": "01/09/2024",
"date": "2024-09-01T00:00:00.000",
"fr": "1er Septembre 2024",
"en": "1st of September 2024"
},
"close_date": {
"date": "15/10/2024",
"date": "2024-10-15T00:00:00.000",
"fr": "15 Octobre 2024",
"en": "15th of October 2024"
},
Expand Down
52 changes: 26 additions & 26 deletions src/data/organisation.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"past" : {
"editions": [ 2016, 2017, 2018, 2019, 2020, 2022, 2023, 2024],
"editions": [ 2016, 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025],
"organizers": [
{ "name": "Aurore Allibe" , "editions": [ true, false, false, false, false, false, false, false], "honnor": false},
{ "name": "Charles Curtit" , "editions": [false, false, false, false, false, false, false, true], "honnor": false},
{ "name": "Cédric Tran-Xuan" , "editions": [ true, true, true, true, true, true, true, false], "honnor": true},
{ "name": "Clément Escoffier" , "editions": [ true, true, true, true, false, false, false, false], "honnor": false},
{ "name": "Dana Popovici" , "editions": [false, false, true, false, false, false, false, false], "honnor": false},
{ "name": "Emmanuel Hugonnet" , "editions": [ true, true, true, false, false, false, false, false], "honnor": false},
{ "name": "Johann Martinson" , "editions": [ true, true, true, true, true, false, false, false], "honnor": false},
{ "name": "Julien Giovaresto" , "editions": [false, false, false, false, false, false, true, false], "honnor": false},
{ "name": "Lorie Piscichio" , "editions": [false, true, true, true, true, true, false, false], "honnor": true},
{ "name": "Ludovic Poitou" , "editions": [false, true, true, true, true, true, true, true], "honnor": false},
{ "name": "Maha Alsayasneh" , "editions": [false, false, false, false, false, false, true, false], "honnor": false},
{ "name": "Mathieu Poissard" , "editions": [false, false, false, false, false, false, false, true], "honnor": false},
{ "name": "Maxime Ducros" , "editions": [false, false, false, true, true, false, false, false], "honnor": false},
{ "name": "Michel Barret" , "editions": [false, false, true, true, true, true, true, true], "honnor": false},
{ "name": "Mickael Istria" , "editions": [true, true, false, false, false, false, false, false], "honnor": false},
{ "name": "Miguel Moquillon" , "editions": [ true, true, true, true, true, true, true, true], "honnor": false},
{ "name": "Ouiame Talbi" , "editions": [false, false, false, false, false, false, false, true], "honnor": false},
{ "name": "Pierrick Rassat" , "editions": [false, false, false, false, false, true, true, true], "honnor": false},
{ "name": "Remy Sanlaville" , "editions": [ true, true, true, true, true, false, false, false], "honnor": false},
{ "name": "Sébastien Chassande-Barrioz", "editions": [false, false, false, true, true, true, true, true], "honnor": false},
{ "name": "Sylvain Bauza" , "editions": [ true, true, true, true, false, false, false, false], "honnor": false},
{ "name": "Virginie Pageaud" , "editions": [false, false, false, false, false, false, false, true], "honnor": false},
{ "name": "Willy Malvault" , "editions": [false, false, false, false, false, false, true, true], "honnor": false},
{ "name": "Yannick Chiron" , "editions": [false, false, false, true, true, true, true, true], "honnor": false},
{ "name": "Yohan Lasorsa" , "editions": [false, false, false, false, false, true, true, true], "honnor": false}
{ "name": "Aurore Allibe" , "editions": [ true, false, false, false, false, false, false, false, false], "honnor": false},
{ "name": "Charles Curtit" , "editions": [false, false, false, false, false, false, false, true, true], "honnor": false},
{ "name": "Cédric Tran-Xuan" , "editions": [ true, true, true, true, true, true, true, false, false], "honnor": true},
{ "name": "Clément Escoffier" , "editions": [ true, true, true, true, false, false, false, false, false], "honnor": false},
{ "name": "Dana Popovici" , "editions": [false, false, true, false, false, false, false, false, false], "honnor": false},
{ "name": "Emmanuel Hugonnet" , "editions": [ true, true, true, false, false, false, false, false, false], "honnor": false},
{ "name": "Johann Martinson" , "editions": [ true, true, true, true, true, false, false, false, false], "honnor": false},
{ "name": "Julien Giovaresto" , "editions": [false, false, false, false, false, false, true, false, false], "honnor": false},
{ "name": "Lorie Piscichio" , "editions": [false, true, true, true, true, true, true, false, false], "honnor": true},
{ "name": "Ludovic Poitou" , "editions": [false, true, true, true, true, true, true, true, true], "honnor": false},
{ "name": "Maha Alsayasneh" , "editions": [false, false, false, false, false, false, true, false, false], "honnor": false},
{ "name": "Mathieu Poissard" , "editions": [false, false, false, false, false, false, false, true, true], "honnor": false},
{ "name": "Maxime Ducros" , "editions": [false, false, false, true, true, false, false, false, false], "honnor": false},
{ "name": "Michel Barret" , "editions": [false, false, true, true, true, true, true, true, true], "honnor": false},
{ "name": "Mickael Istria" , "editions": [true, true, false, false, false, false, false, false, false], "honnor": false},
{ "name": "Miguel Moquillon" , "editions": [ true, true, true, true, true, true, true, true, true], "honnor": false},
{ "name": "Ouiame Talbi" , "editions": [false, false, false, false, false, false, false, true, true], "honnor": false},
{ "name": "Pierrick Rassat" , "editions": [false, false, false, false, false, true, true, true, true], "honnor": false},
{ "name": "Remy Sanlaville" , "editions": [ true, true, true, true, true, false, false, false, false], "honnor": false},
{ "name": "Sébastien Chassande-Barrioz", "editions": [false, false, false, true, true, true, true, true, true], "honnor": false},
{ "name": "Sylvain Bauza" , "editions": [ true, true, true, true, false, false, false, false, false], "honnor": false},
{ "name": "Virginie Pageaud" , "editions": [false, false, false, false, false, false, false, true, true], "honnor": false},
{ "name": "Willy Malvault" , "editions": [false, false, false, false, false, false, true, true, true], "honnor": false},
{ "name": "Yannick Chiron" , "editions": [false, false, false, true, true, true, true, true, true], "honnor": false},
{ "name": "Yohan Lasorsa" , "editions": [false, false, false, false, false, true, true, true, true], "honnor": false}
]
},
"roles": [
Expand Down
5 changes: 2 additions & 3 deletions src/data/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
"sponsorship": {
"prospectus": "https://drive.google.com/file/d/1hOHTGVXJfiQ0nJFJugivkNr3SwdEXuSF/view?usp=share_link",
"open_datetime" : {
"date": "2024-06-17T11:00:00.000",
"fr": "17 juin 2024 à 11h00",
"en": "17th of June 2024 at 11:00am"
},
"subscription_status_values": "[not_open|open|closed]",
"subscription_status": "not_open",
"subscribe_link" : "",
"subscribe_link" : "https://docs.google.com/forms/d/e/1FAIpQLSf8fpWvTQTFy0tJnFcCCkQEttTUAnfM3GJ0ksNwG9tnX7FubQ/viewform?usp=sf_link",
"type": {
"flocon": {
"title": "Flocon",
Expand Down
2 changes: 2 additions & 0 deletions src/data/ticket.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"price_univ": 160,
"possible_status": ["not_open", "open", "closed", "deactivated"],
"status": "not_open",
"beginDate": "2024-11-18T11:00:00.000",
"endDate": "2025-01-20T00:00:00.000",
"open_date": {
"default": "unknown",
"fr": "18 Novembre à 11h00",
Expand Down
27 changes: 26 additions & 1 deletion src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export function init() {
i18n.snowcamp_logo_usage = 'Authorisation to use the SnowCamp logo for your communications';
i18n.sponsorship_prospectus = 'Sponsorship Prospectus';
i18n.contact_us = 'Contact us';
i18n.why_become_sponsor='Why become sponsor?';
i18n.sponsor_options='Sponsoring options';
i18n.sponsor_desc = `<p class="text dark-background">
Snowcamp is organized by a group of geeky volonteers. Their only motivation
is to propose a unique conference gathering innovation and research.
Expand All @@ -127,7 +129,30 @@ export function init() {
demonstrate your products and services, and to make yourself known.
</p>
</p>`;
i18n.sponsor_notice = `<p class="text dark-background">Notice: Upon receipt of the invoice by the sponsor,

i18n.sponsor_subscription_title = 'The registration';
i18n.sponsor_subscription = `The registration process has 2 steps:
<ol>
<li style="font-size: 1em; margin-left: 30px;">Since the open date of the sponsoring campaign, you can use the online form to register your company.
For the Etoile sponsor, this registratrion sets your ranking and therefore the booth.</li>
<li style="font-size: 1em; margin-left: 30px;">After the registration step the Snowcamp organisation team sends you an invoice by email
Since the reception of the invoice, the sponsor has 90 days to make the payment.
After that delay, the snowcamp organisation has the right to cancel the contract with that sponsor and to replace this sponsor.</li></ol>`;

i18n.sponsoring_not_open=`The registration for the Snowcamp ${edition.year} will open on
<div style="text-align: center; font-weight: bold; font-size: 1.3em; margin: 10px 0">${sponsors.sponsorship.open_datetime.en}</div>
Please come back after that moment, in order to register your company as sponsor. The snowcamp organisation team will send a reminder to
all previous sponsors.`;
i18n.sponsoring_open=(sponsors:any) => `The registration for the Snowcamp ${edition.year} is open since
<div style="text-align: center; font-weight: bold; font-size: 1.3em; margin: 10px 0">${sponsors.sponsorship.open_datetime.en}</div>
${12 - sponsors.etoile.length} slots of Etoile sponsor and ${6 - sponsors.flocon.length} slots of Flocon sponsor are available.
<br>Use the following online <a href="${sponsors.sponsorship.subscribe_link}">registration form</a>`;
i18n.sponsoring_closed=`The sponsoring campaign of the session ${edition.year}. Hence, it is no more possible to become sponsor for the session ${edition.year}.
You can contact us if you wish to belong our contact list in order to be alerted for the next edition of the Snowcamp.`;
i18n.sponsoring_question='For any information, contact us by email';


i18n.sponsor_notice = `<p class="text dark-background">Notice: Upon receipt of the invoice by the sponsor,
the sponsor has 90 days to complete all administrative registration procedures and make the payment.
If this deadline is not adhered to by a sponsor, the Snowcamp organization reserves the right to cancel
the contract with that sponsor to make way for another sponsor.</p>`;
Expand Down
Loading

0 comments on commit 8c11f26

Please sign in to comment.