Skip to content

Commit

Permalink
Add the option to run a dev site.
Browse files Browse the repository at this point in the history
Edit the `dev.ts` file for the geographies you want to load and run `deno task dev`
  • Loading branch information
luke-strange committed Jul 31, 2024
1 parent 8da9fce commit c86b9f7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"lume": "echo \"import 'lume/cli.ts'\" | deno run -A --unstable-ffi -",
"build": "deno task vr provision && deno task lume",
"serve": "deno task lume -s",
"dev": "SMALL_SITE=true deno task serve",
"vr": "deno run -qA https://code.velociraptor.run"
},
"compilerOptions": {
Expand Down
14 changes: 14 additions & 0 deletions dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const smallSiteAreas = {
"E06000001":{
"dwellingsLastPublished":2023,
"vacantsLastPublished":2023.0,
"active":true,
"name":"Hartlepool"
},
"E06000002":{
"dwellingsLastPublished":2023,
"vacantsLastPublished":2023.0,
"active":true,
"name":"Middlesbrough"
}
};
4 changes: 2 additions & 2 deletions src/_includes/template/areas.vto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vispage: Areas
<li><a href="#affordable-homes">Affordable homes</a></li>
</ol>

{{# <h3>Vacant homes in {{ title }} <a id='vacant-homes' class='anchor' href='#vacant-homes' data-dependencies='/assets/js/section-links.js'>§</a></h3>
<h3>Vacant homes in {{ title }} <a id='vacant-homes' class='anchor' href='#vacant-homes' data-dependencies='/assets/js/section-links.js'>§</a></h3>

{{ set percentage_chart_data = percentage(areacode) }}

Expand Down Expand Up @@ -120,7 +120,7 @@ vispage: Areas
}
})
}}
<p>Dwelling count estimates are from <a href="Dwelling count estimates are from Table 125: dwelling stock estimates by local authority district. Household estimates are from the 2018-based household projections for local authorities and higher adminstrative areas within England.">Table 125: dwelling stock estimates by local authority district</a>. Household estimates are from the <a href="https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationprojections/datasets/householdprojectionsforengland">2018-based household projections for local authorities and higher adminstrative areas within England</a>.</p> #}}
<p>Dwelling count estimates are from <a href="Dwelling count estimates are from Table 125: dwelling stock estimates by local authority district. Household estimates are from the 2018-based household projections for local authorities and higher adminstrative areas within England.">Table 125: dwelling stock estimates by local authority district</a>. Household estimates are from the <a href="https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationprojections/datasets/householdprojectionsforengland">2018-based household projections for local authorities and higher adminstrative areas within England</a>.</p>

<h3>Affordable homes in {{ title }} <a id='affordable-homes' class='anchor' href='#affordable-homes' data-dependencies='/assets/js/section-links.js'>§</a></h3>
{{ set chart_data = affordableHomes(areacode) }}
Expand Down
7 changes: 7 additions & 0 deletions src/data/areas/place-page/index.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
export const layout = "template/areas.vto";
export const tags = ["area"];

const SMALL_SITE = Deno.env.get('SMALL_SITE') !== undefined;
import { smallSiteAreas } from "../../../../dev.ts";

export default function* ({areas}) {
if (SMALL_SITE === true) {
areas = smallSiteAreas;
}
for (const [key, value] of Object.entries(areas)){
yield {
url: `/data/areas/${key}/`,
Expand All @@ -11,6 +17,7 @@ export default function* ({areas}) {
areas: null, // mask the areas data from other pages.
key: null,
value: null,
test: null,
};
}
}
Expand Down

0 comments on commit c86b9f7

Please sign in to comment.