Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹 Section: Remove Navigation in favor of SectionNavigation Gizmo #1989

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/furniture/section_navigation/section_navigation.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class SectionNavigation
class SectionNavigation < Furniture
location(parent: :room)
default_scope { where(furniture_kind: "section_navigation") }

def rooms
space.rooms.where.not(id: space.entrance_id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<div class="mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-4 items-center">
<% policy_scope(section_navigation.rooms).each do |room| %>
<%= link_to [room.space, room], class: "no-underline" do %>
<%= render CardComponent.new(
data: { access_level: room.access_level, slug: room.slug, model: "room", id: room.id },
classes: "group self-stretch hover:bg-orange-50"
) do %>
<%= link_to polymorphic_path(room.location), class: "no-underline" do %>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why, but link_to is including the full url; which I think is related to our over-loading of url_for.

I didn't want to get into it; but it's annoying.

<%= render CardComponent.new(classes: "group self-stretch hover:bg-orange-50") do %>
<div class="px-4 py-5 flex items-center justify-between">
<h3 class="text-base font-semibold text-orange-500 group-hover:text-orange-400">
<%= room.name %>
Expand Down
6 changes: 0 additions & 6 deletions app/views/rooms/_room.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@
<%= render room.gizmos.rank(:slot) %>
</section>
</div>

<div class="mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-4 items-center">
<% policy_scope(room.space.rooms).each do |room| %>
<%= render partial: 'spaces/room_card', locals: { room: room } %>
<% end %>
</div>
</div>
18 changes: 0 additions & 18 deletions app/views/spaces/_room_card.html.erb

This file was deleted.

3 changes: 0 additions & 3 deletions features/harness/Components.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import Component from "./Component.js";
import RoomCardComponent from "./RoomCardComponent.js";
import PersonNavigationComponent from "./PersonNavigationComponent.js";
export { Component };
export { RoomCardComponent };
export { PersonNavigationComponent };
export default {
Component,
RoomCardComponent,
PersonNavigationComponent,
};
59 changes: 0 additions & 59 deletions features/harness/RoomCardComponent.js

This file was deleted.

4 changes: 2 additions & 2 deletions features/harness/RoomFormComponent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from "./Component.js";
import Room from "../lib/Room.js";
class RoomCardComponent extends Component {
class RoomFormComponent extends Component {
/**
* @param {ThenableWebDriver} driver
* @param {Room} room
Expand All @@ -18,4 +18,4 @@ class RoomCardComponent extends Component {
return this;
}
}
export default RoomCardComponent;
export default RoomFormComponent;
10 changes: 0 additions & 10 deletions features/harness/SpaceEditPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ThenableWebDriver } from "selenium-webdriver";
import Page from "./Page.js";
import Room from "../lib/Room.js";
import RoomCardComponent from "./RoomCardComponent.js";
import Component from "./Component.js";
class SpaceEditPage extends Page {
/**
Expand All @@ -20,14 +18,6 @@ class SpaceEditPage extends Page {
return `/spaces/${this.space.slug}/edit`;
}

/**
* @param {Room} room
* @returns {RoomCardComponent}
*/
roomCard(room) {
return new RoomCardComponent(this.driver, room);
}

createRoom({ room }) {
return new RoomFormComponent(this.driver)
.fillIn(room)
Expand Down
21 changes: 0 additions & 21 deletions features/harness/SpacePage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import assert$0 from "assert";
import Page from "./Page.js";
import RoomCardComponent from "./RoomCardComponent.js";
const assert = assert$0.strict;
class SpacePage extends Page {
constructor(driver, space) {
super(driver);
Expand All @@ -13,23 +10,5 @@ class SpacePage extends Page {
path() {
return `/spaces/${this.space.slug}`;
}
/**
* @param {Room} room
* @returns {RoomCardComponent}
*/
roomCard(room) {
return new RoomCardComponent(this.driver, room);
}
/**
*
* @param {*} filters
* @returns {Promise<RoomCardComponent[]}
*/
roomCardsWhere(filters) {
const { accessLevel } = filters;
return this.driver
.findElements(accessLevel.locator)
.then((elements) => elements.map((e) => new RoomCardComponent(e)));
}
}
export default SpacePage;
45 changes: 0 additions & 45 deletions features/rooms/entering-rooms.feature

This file was deleted.

9 changes: 0 additions & 9 deletions features/steps/deployment_steps.js

This file was deleted.

4 changes: 0 additions & 4 deletions features/steps/generic_step.js

This file was deleted.

4 changes: 2 additions & 2 deletions features/steps/identification_steps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert$0 from "assert";
import { Given, When, Then } from "@cucumber/cucumber";
import { SignInPage, SpacePage, MePage } from "../harness/Pages.js";
import { Space, Actor } from "../lib/index.js";
import { SignInPage, MePage } from "../harness/Pages.js";
import { Actor } from "../lib/index.js";
const assert = assert$0.strict;
Given(
"an unauthenticated {actor} has requested to be identified to {a} {space} via Email",
Expand Down
17 changes: 0 additions & 17 deletions features/steps/invitation_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,3 @@ Then(
);
},
);
Then(
"all other Invitations to {actor} for {a} {space} no longer have {a} status of {string}",
/**
* @param {Actor} actor
* @param {Space} space
* @param {string} status
*/
function (actor, _a, space, _a2, status) {
return actor
.signIn(this.driver, space)
.then(() => new MembershipsIndexPage(this.driver, space).visit())
.then((page) => page.invitations({ to: actor }))
.then((invitations) =>
assert(invitations.every((i) => i.status !== status)),
);
},
);
41 changes: 1 addition & 40 deletions features/steps/room_steps.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
import { Given, When, Then } from "@cucumber/cucumber";
import {
SpacePage,
SpaceEditPage,
RoomEditPage,
RoomPage,
} from "../harness/Pages.js";
import { RoomCardComponent } from "../harness/Components.js";
import {
Space,
Room,
Actor,
linkParameters,
AccessLevel,
} from "../lib/index.js";
import assert$0 from "assert";
const assert = assert$0.strict;
import { Given, Then } from "@cucumber/cucumber";
Given(
"{a} {space} with {a} {accessLevel} {room}",
async function (_, space, _1, accessLevel, room) {
Expand All @@ -29,30 +13,7 @@ Given(
},
);

When("the {actor} taps the {room} in the Room Picker", function (actor, room) {
return this.space.roomCard(room).enter();
});
Then("the {actor} is placed in the {room}", async function (actor, room) {
const roomPage = new RoomPage(this.driver, room);
assert(await roomPage.hasContent(room.name));
});
Then("the {actor} is not placed in the {room}", function (actor, room) {
// Write code here that turns the phrase above into concrete actions
return "pending";
});

Then("the {space} has a {room}", function (space, room) {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
Then(
"the {actor} does not see the {room}'s Door",
async function (actor, room) {
const card = new RoomCardComponent(this.driver, room);
assert(!(await card.isDisplayed()));
},
);
Then("{a} {room} is {accessLevel}", async function (_a, room, accessLevel) {
const { space } = linkParameters({ room, accessLevel });
await new SpacePage(this.driver, space).visit();
});
Loading