Skip to content
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
2 changes: 2 additions & 0 deletions docs/ai-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ After the peer reviews, we used AI to help us split up `ExplorePlants.tsx`, whic

All AI-generated suggestions were reviewed, tested and adapted by the team before they were committed. Every change went through a pull request that had to be approved by another group member (see [quality.md](quality.md#work-practices)), so no AI-generated code was merged without a review. Design and architectural decisions were made by the team.

In retrospect vi could have added a globall context-file for the AI models used. This would have been helpfull to make sure all AI models used followed the same rules. In future we would do this.

### Being critical of a suggestion from AI

We did not always follow the suggestions from AI. For example, when My Matches was changed to fetch one page of plants at a time, the old `matchedPlants` field on the user was no longer used by the app. AI first suggested keeping the field because the tests used it, but we decided to remove it, since keeping unused code only for the tests made no sense. Before removing it, we searched the code for every place it was used, to make sure it was safe. Then we updated the tests to use the new field, and wrote new tests for the `myMatches` query.
Binary file added docs/media/drawnExplorePage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/drawnFlowerCard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/drawnProfilePage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/figmaMockUp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion docs/quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,23 @@ GitHub Actions ([.github/workflows/ci.yml](../.github/workflows/ci.yml)) runs on

## Work practices

- Before development began, the group created a prototype in Figma to establish a shared visual understanding of the application and agree on the design before writing code.
### Ideation process

- Before development began, we sketched the main functions of the application by hand: the Explore page, where users can search and filter all plants, mark plants as favourites and mark plants they own; the plant card; and the profile page with information about the user. This gave the group a shared understanding of what the application should do before writing any code. This also made it easier to communicate ideas about the project.

<img src="media/drawnExplorePage.png" alt="Hand-drawn sketch of the Explore page with a sidebar menu, a search bar, a filter button and a grid of plant cards" width="500">

<img src="media/drawnFlowerCard.png" alt="Hand-drawn sketch of a plant card with an info icon, a heart icon and an &quot;I have this one!&quot; button" width="300">

<img src="media/drawnProfilePage.png" alt="Hand-drawn sketch of the profile page with a profile picture and fields for information about the user" width="500">

- We then used Figma to find inspiration for colours and layout. The mock-up below was used as a reference for the visual style, not as a finished design.

<img src="media/figmaMockUp.png" alt="Figma mock-up of a plant app with a green sidebar menu, a search bar, plant cards with photos and a list of care tasks" width="500">

- The sketches and the mock-up were a starting point. A lot of iteration happened during development: features, layout and design choices changed as we built the application, tested it, got feedback from others in the course and gave to each other, so the final application differs in many ways from the first sketches.

### Practices during development

- We followed three rules before merging a pull request:
1. **At least one member of IT2810-H26-T03 had to approve the pull request.** Members could not approve their own pull requests, and staff approvals did not count towards this requirement. This ensured that team members reviewed each other's code.
Expand Down
3 changes: 2 additions & 1 deletion e2e/uiImages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ test("the placeholder picture loads on plant cards without an image", async ({
(element) => getComputedStyle(element, "::before").backgroundImage,
);
const url = backgroundImage.match(/url\("?(.*?)"?\)/)?.[1];
expect(url).toContain("plantPlaceholder.png");
// Vite adds a hash to the file name in the build, for example plantPlaceholder-a1b2c3.png
expect(url).toContain("plantPlaceholder");

expect(await loadImageWidth(page, url!)).toBeGreaterThan(0);
});
13 changes: 5 additions & 8 deletions frontend/src/components/plantCard/PlantCard.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@
overflow: hidden;
}

/* The back of the card is too close to the page color in dark mode, so it gets
a light green border to show where it ends */
[data-theme="dark"] .plant-card-back {
border: 2px solid var(--dark-green);
}

.plant-card-front {
background: var(--card-front);
}
Expand Down Expand Up @@ -229,7 +223,7 @@
content: "";
position: absolute;
inset: 0;
background: url("/plantPlaceholder.png") center / cover no-repeat;
background: url("../../assets/plantPlaceholder.png") center / cover no-repeat;
}

.plant-card-front .plant-card-preferences {
Expand Down Expand Up @@ -291,8 +285,11 @@
color: var(--text-light);
}

/* The back is dark pink like the front's corner, so the back's corner gets the
front's color, to match */
.plant-card-face-back .plant-card-flap {
--flap-fill: var(--cream);
--flap-fill: var(--card-front);
--flap-border: var(--soft-green);
}

.plant-card-back .plant-card-hint,
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/sidebar/Sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
border-radius: 0.6rem;
color: var(--sidebar-text);
text-decoration: none;
font-size: 1.1rem;
font-size: 1.3rem;
font-weight: 500;
border: 1px solid transparent;
transition:
Expand Down Expand Up @@ -70,13 +70,17 @@
}

.sidebar_title {
font-size: 2rem;
font-size: 2.3rem;
font-weight: 600;
margin-top: 1em;
margin-bottom: 1rem;
text-align: center;
}

.sidebar__heart {
color: var(--dark-pink);
}

.close-button {
display: none;
}
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/components/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type SidebarProps = {
export default function Sidebar({ isOpen, onCloseSidebar, ref }: SidebarProps) {
const { t } = useTranslation();
const closeButtonRef = useRef<HTMLButtonElement>(null);
// The title is "I <3 Plants". The heart is put in its own span so it can be pink.
const [titleStart, titleEnd] = t("sidebar.title").split("<3");

// On mobile the sidebar opens over the page. Focus moves into it when it
// opens, and Escape closes it, like other dialogs and menus.
Expand Down Expand Up @@ -48,7 +50,13 @@ export default function Sidebar({ isOpen, onCloseSidebar, ref }: SidebarProps) {
</button>

<h2 className="sidebar_title" id="sidebar-title">
{t("sidebar.title")}
{titleStart}
{titleEnd !== undefined && (
<>
<span className="sidebar__heart">{"<3"}</span>
{titleEnd}
</>
)}
</h2>
<nav className="sidebar__nav" aria-label={t("sidebar.navigationLabel")}>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ textarea {
--text-on-green-muted: #d9dcc8;
/* The folded corner on the front of the plant card */
--card-flap: var(--dark-pink);
--card-back: #5c6b42;
--card-back: var(--dark-pink);
--dark-pink: #9e3050;
--pink-text: #9e3050;
--light-pink: #fce8ee;
Expand Down Expand Up @@ -101,7 +101,7 @@ textarea {
--text-on-green: #1f2a22;
--light-green: #2f3329;
--text-on-green-muted: #2f3329;
--card-back: #5e6b48;
--card-back: var(--dark-pink);
--dark-pink: #c2476b;
--light-pink: #4a2a35;
--pink-text: #ffffff;
Expand Down
31 changes: 25 additions & 6 deletions frontend/src/pages/plantMatch/PlantMatchPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
align-items: center;
margin-top: 12px;
gap: 20px;
/* Shows the card and the skip/like buttons 10 % bigger */
zoom: 1.1;
}

.plant-card-container {
Expand Down Expand Up @@ -224,13 +226,30 @@
overflow-x: hidden;
}

/* On mobile the card takes the whole first row and the skip/like buttons
sit side by side underneath it */
.plant-match {
/* A slightly smaller card so the card and the buttons fit better on screen */
--plant-card-width: min(250px, 66vw);
--plant-card-height: min(450px, 62vh);

position: relative;
gap: 9px;
display: grid;
grid-template-columns: auto auto;
justify-content: center;
justify-items: center;
column-gap: 40px;
row-gap: 20px;
}

.plant-card-container {
flex: 0 0 auto;
grid-column: 1 / -1;
grid-row: 1;
}

.dislike-button,
.like-button {
grid-row: 2;
}

.match-info-button {
Expand Down Expand Up @@ -259,10 +278,10 @@
}

.swipe-button {
width: 64px;
height: 64px;
flex: 0 0 64px;
font-size: 30px;
width: 80px;
height: 80px;
flex: 0 0 80px;
font-size: 36px;
}

.plant-card-front .plant-card-preferences {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/plantOwnerTest/PlantOwnerTestPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
background: var(--dark-green);
color: var(--text-on-green);
font-family: var(--font-text);
font-size: 1.15rem;
font-size: 1.45rem;
font-weight: 500;
line-height: 1.7;
line-height: 1.5;
text-align: left;
cursor: pointer;
transition:
Expand Down Expand Up @@ -202,7 +202,7 @@
.plant-owner-test-option {
min-height: 100px;
padding: 1rem;
font-size: 1rem;
font-size: 1.15rem;
}

.plant-owner-test-result {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/profile/ProfilePage.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
box-sizing: border-box;
}


.profile > * {
zoom: 1.1;
}

.profile-info {
display: flex;
align-items: flex-start;
Expand Down
Loading