Skip to content

Commit

Permalink
🔧 Modify Generate Planets
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlee-dev committed Sep 24, 2019
1 parent d751923 commit c2bda7d
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 288 deletions.
35 changes: 28 additions & 7 deletions cypress/fixtures/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export const mockState = {
location: {
id: 'd23cd552-b79b-4752-86d8-9abb22d04c27',
isHomePlanet: true,
location: 99,
location: {
x: 0.22,
y: 0.03
},
name: 'Kennajeannet',
items: [
{
Expand Down Expand Up @@ -83,7 +86,10 @@ export const mockState = {
location: {
id: '83a7a2b7-3e94-4968-ab35-edb37c30f6ea',
isHomePlanet: false,
location: 51,
location: {
x: -0.3,
y: -0.14
},
name: 'Gaffey',
items: [
{
Expand Down Expand Up @@ -131,7 +137,10 @@ export const mockState = {
location: {
id: 'd23cd552-b79b-4752-86d8-9abb22d04c27',
isHomePlanet: true,
location: 99,
location: {
x: 0.22,
y: 0.03
},
name: 'Kennajeannet',
items: [
{
Expand Down Expand Up @@ -178,7 +187,10 @@ export const mockState = {
location: {
id: '83a7a2b7-3e94-4968-ab35-edb37c30f6ea',
isHomePlanet: false,
location: 51,
location: {
x: -0.3,
y: -0.14
},
name: 'Gaffey',
items: [
{
Expand Down Expand Up @@ -219,7 +231,10 @@ export const mockState = {
{
id: 'd23cd552-b79b-4752-86d8-9abb22d04c27',
isHomePlanet: true,
location: 99,
location: {
x: 0.22,
y: 0.03
},
name: 'Kennajeannet',
items: [
{
Expand All @@ -237,7 +252,10 @@ export const mockState = {
{
id: '650f6b64-a7ff-4b72-b75c-a376bf1e4446',
isHomePlanet: false,
location: 96,
location: {
x: -0.29,
y: -0.32
},
name: 'Richardspalding',
items: [
{
Expand All @@ -255,7 +273,10 @@ export const mockState = {
{
id: '83a7a2b7-3e94-4968-ab35-edb37c30f6ea',
isHomePlanet: false,
location: 51,
location: {
x: -0.3,
y: -0.14
},
name: 'Gaffey',
items: [
{
Expand Down
260 changes: 0 additions & 260 deletions cypress/fixtures/state.json

This file was deleted.

28 changes: 15 additions & 13 deletions src/components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ const Map = ({ currentShipLocation, planets, ship }) => {
const svg = createSvg('#map-root', height, width)

// TODO - Incorporate this into generatePlanets()
const planet1Location = { x: -0.25, y: 0 }
const planet2Location = { x: 0, y: 0 }
const planet3Location = { x: 0.25, y: 0 }
const mockPlanetLocations = [
planet1Location,
planet2Location,
planet3Location
]

const nodes_data = planets.map((planet, i) => ({
...planet,
location: mockPlanetLocations[i]
}))
// const planet1Location = { x: 0.1, y: 0.4 }
// const planet2Location = { x: -0.01, y: -0.03 }
// const planet3Location = { x: 0.03, y: 0.36 }
// const mockPlanetLocations = [
// planet1Location,
// planet2Location,
// planet3Location
// ]

// const nodes_data = planets.map((planet, i) => ({
// ...planet,
// location: mockPlanetLocations[i]
// }))

const nodes_data = planets

const links_data = [
{ source: nodes_data[0].name, target: nodes_data[1].name },
Expand Down
Loading

0 comments on commit c2bda7d

Please sign in to comment.