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

Release #848

Merged
merged 65 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2361cf0
build(deps-dev): bump @types/react from 18.3.3 to 18.3.11
dependabot[bot] Oct 7, 2024
8fe0f0d
build(deps-dev): bump eslint-config-next from 14.2.5 to 14.2.14
dependabot[bot] Oct 7, 2024
702ce77
build(deps): bump next-intl from 3.17.2 to 3.20.0
dependabot[bot] Oct 8, 2024
1c5ae00
Merge pull request #816 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 8, 2024
712a7eb
Merge pull request #815 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 8, 2024
b333442
Merge pull request #814 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 8, 2024
3026aa0
build(deps-dev): bump @playwright/test from 1.46.1 to 1.47.2
dependabot[bot] Oct 8, 2024
3ea4cdf
Merge pull request #812 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 8, 2024
90b1527
build(deps-dev): bump eslint-config-next from 14.2.14 to 14.2.15
dependabot[bot] Oct 9, 2024
0392b9d
build(deps): bump typescript from 5.5.4 to 5.6.3
dependabot[bot] Oct 9, 2024
9b34d6b
build(deps): bump next from 14.2.14 to 14.2.15
dependabot[bot] Oct 9, 2024
5464d14
Merge pull request #821 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 10, 2024
ad7333f
Merge pull request #820 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 10, 2024
e15a233
build(deps-dev): bump @playwright/test from 1.47.2 to 1.48.0
dependabot[bot] Oct 10, 2024
7160a98
Merge pull request #818 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 10, 2024
39416c9
Merge pull request #819 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 10, 2024
82ad7b2
feat: Init Change to UseAppRouter
philipbrembeck Oct 14, 2024
ebf121f
Merge pull request #823 from frontendnetwork/feat/UseAppRouter
philipbrembeck Oct 15, 2024
29ef63c
feat: Change Package manager to pnpm
philipbrembeck Oct 17, 2024
a73171d
fix: Use pnpm action
philipbrembeck Oct 17, 2024
15853f3
ci: Cache dependencies
philipbrembeck Oct 17, 2024
3d2ed98
Merge pull request #830 from frontendnetwork/feat/PNPM
philipbrembeck Oct 17, 2024
f1073bc
fix: Remove package-lock.json
philipbrembeck Oct 17, 2024
9d5164a
Merge pull request #831 from frontendnetwork/feat/PNPM
philipbrembeck Oct 17, 2024
53798ad
build(deps): bump next-intl from 3.20.0 to 3.21.1
dependabot[bot] Oct 17, 2024
fc3158c
build(deps): bump pnpm/action-setup from 2 to 4
dependabot[bot] Oct 18, 2024
6204563
Merge pull request #835 from frontendnetwork/dependabot/github_action…
kodiakhq[bot] Oct 19, 2024
11adbe9
feat: Refactor code
philipbrembeck Oct 19, 2024
5a8b5f8
Merge pull request #824 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 20, 2024
ed13958
fix: Memoize shareOptions
philipbrembeck Oct 26, 2024
dbc31f8
feat: Upgrade to Next.js 15 / React 19
philipbrembeck Oct 26, 2024
ce7034d
Merge branch 'staging' into feat/PNPM
philipbrembeck Oct 26, 2024
d98829b
docs: Remove seperate documents as they're not needed anymore
philipbrembeck Oct 26, 2024
af1c8e3
Merge branch 'feat/PNPM' of https://github.com/frontendnetwork/vegani…
philipbrembeck Oct 26, 2024
93a5814
chore: Use Interface on memo
philipbrembeck Oct 26, 2024
ebf2f4e
fix: Use of math in sass files
philipbrembeck Oct 26, 2024
1b3bc1c
feat: Major refactor for performance improvements
philipbrembeck Oct 26, 2024
b828495
fix: Minor issues (CC: Sonar)
philipbrembeck Oct 26, 2024
b14b4a5
fix: Remove type any
philipbrembeck Oct 26, 2024
5c5f401
fix: Union type overwrite
philipbrembeck Oct 26, 2024
f8589fc
feat: Upgrade to next.config.ts
philipbrembeck Oct 26, 2024
f1db1a9
chore(deps): Upgrade ESLint v9
philipbrembeck Oct 26, 2024
7b12150
ci: Update pnpm version
philipbrembeck Oct 26, 2024
93b1f4e
feat: Improve React. imports as direct imports
philipbrembeck Oct 26, 2024
cc5b6d0
feat: Add preprocessor to ingredients form
philipbrembeck Oct 26, 2024
f9d4634
fix(a11y): Change color on source links for AAA contrast ratio
philipbrembeck Oct 26, 2024
ca8ff21
fix: Linting error import/order
philipbrembeck Oct 26, 2024
bb2175f
test: Add unit tests for utils
philipbrembeck Oct 26, 2024
e830504
Merge pull request #836 from frontendnetwork/feat/PNPM
philipbrembeck Oct 26, 2024
3201965
build(deps): bump sass from 1.79.4 to 1.80.4
dependabot[bot] Oct 26, 2024
df5166f
build(deps): bump @types/node from 22.5.4 to 22.8.1
dependabot[bot] Oct 26, 2024
8f88c40
Merge pull request #845 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 26, 2024
4621cb9
build(deps): bump @frontendnetwork/veganify from 1.2.5 to 1.2.9
dependabot[bot] Oct 26, 2024
8e6e1ed
Merge pull request #844 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 26, 2024
c2aaa8e
Merge pull request #843 from frontendnetwork/dependabot/npm_and_yarn/…
kodiakhq[bot] Oct 26, 2024
5398ef6
ci: Run e2e tests after deploying
philipbrembeck Oct 26, 2024
b3cc54b
chore: Setup Playwright
philipbrembeck Oct 26, 2024
9a4f2c9
feat: Reuse License modal
philipbrembeck Oct 26, 2024
d48d2dc
test: Change E2E to staging url
philipbrembeck Oct 26, 2024
fa96159
fix: Product Hunt Badge size
philipbrembeck Oct 26, 2024
a290320
docs: Added improved dev guide
philipbrembeck Oct 26, 2024
7aa9a50
docs: Formatting
philipbrembeck Oct 26, 2024
9cbaade
Feature/v1 api (#847)
philipbrembeck Oct 27, 2024
3cb0fc9
test: Add e2e tests
philipbrembeck Oct 27, 2024
45ba41c
Merge branch 'main' into staging
philipbrembeck Oct 27, 2024
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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,6 @@ jobs:
sleep 30

- name: Run Playwright tests
env:
CI: true
run: npx playwright test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
test-results/.last-run.json

# tests
test-results/
playwright-report/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@ducanh2912/next-pwa": "^10.2.9",
"@ericblade/quagga2": "^1.8.4",
"@frontendnetwork/veganify": "^1.2.9",
"@frontendnetwork/veganify": "^1.3.0",
"@types/node": "22.8.1",
"@types/react-dom": "npm:[email protected]",
"jest-worker": "^29.7.0",
Expand Down
15 changes: 15 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import { defineConfig } from "@playwright/test";

// Default to localhost for local development, use staging URL for CI
const baseURL = process.env.CI
? "https://staging.veganify.app"
: "http://localhost:3000";

export default defineConfig({
testMatch: ["**/*.spec.ts"],
use: {
baseURL,
},
webServer: process.env.CI
? undefined
: {
command: "pnpm dev",
url: "http://localhost:3000",
reuseExistingServer: true,
},
});
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/components/IngredientsCheck/IngredientsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ export function IngredientsForm() {
vegan: null,
surelyVegan: [],
notVegan: [],
maybeVegan: [],
maybeNotVegan: [],
unknown: [],
});
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(false);

async function handleSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
setResult({ vegan: null, surelyVegan: [], notVegan: [], maybeVegan: [] });
setResult({
vegan: null,
surelyVegan: [],
notVegan: [],
maybeNotVegan: [],
unknown: [],
});
setError(null);

const formData = new FormData(event.currentTarget);
Expand Down
46 changes: 32 additions & 14 deletions src/components/IngredientsCheck/IngredientsList.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
import React from "react";
import { IconClassType } from "./models/Tooltip";
import { TranslationFunction } from "./models/TranslateFunction";
import { TooltipClient } from "./shared/Tooltip";

export function IngredientList({
items,
iconClass,
}: {
interface IngredientListProps {
items: string[];
iconClass: string;
}) {
iconClass: IconClassType;
t: TranslationFunction;
}

export function IngredientList({ items, iconClass, t }: IngredientListProps) {
const tooltipMessages = {
"maybe-vegan": t("maybe_vegan"),
"unknown-vegan": t("unknown_vegan"),
} as const;

const shouldShowTooltip =
iconClass.includes("maybe-vegan") || iconClass.includes("unknown-vegan");
const tooltipBaseClass = iconClass.split(
" "
)[0] as keyof typeof tooltipMessages;
const tooltipMessage = shouldShowTooltip
? tooltipMessages[tooltipBaseClass]
: "";

return (
<>
{items.map((item) => (
<div className="Grid" key={item}>
<div className="Grid-cell description">
{item.charAt(0).toUpperCase() + item.slice(1)}
</div>
<div className="Grid-cell icons">
<span className={iconClass}></span>
<TooltipClient message={tooltipMessage as string} key={item}>
<div className="Grid">
<div className="Grid-cell description">
{item.charAt(0).toUpperCase() + item.slice(1)}
</div>
<div className="Grid-cell icons">
<span className={iconClass}></span>
</div>
</div>
</div>
</TooltipClient>
))}
</>
);
Expand Down
24 changes: 16 additions & 8 deletions src/components/IngredientsCheck/ResultsDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { IngredientList } from "./IngredientsList";
import { IngredientResult } from "./models/IngredientResult";
import { TranslationFunction } from "./models/TranslateFunction";
import { SourceInfo } from "./SourceInfo";

export function ResultDisplay({
result,
t,
}: {
interface ResultDisplayProps {
result: IngredientResult;
t: (key: string, values?: Record<string, string>) => string;
}) {
t: TranslationFunction;
}

export function ResultDisplay({ result, t }: ResultDisplayProps) {
return (
<div id="result">
<div className="">
Expand All @@ -28,14 +28,22 @@ export function ResultDisplay({
<IngredientList
items={result.notVegan}
iconClass="non-vegan icon-cancel"
t={t}
/>
<IngredientList
items={result.unknown}
iconClass="unknown-vegan icon-help"
t={t}
/>
<IngredientList
items={result.maybeVegan}
iconClass="maybe-vegan icon-help"
items={result.maybeNotVegan}
iconClass="maybe-vegan icon-attention-alt"
t={t}
/>
<IngredientList
items={result.surelyVegan}
iconClass="vegan icon-ok"
t={t}
/>
<SourceInfo t={t} />
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/IngredientsCheck/models/IngredientResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export interface IngredientResult {
vegan: boolean | null;
surelyVegan: string[];
notVegan: string[];
maybeVegan: string[];
maybeNotVegan: string[];
unknown: string[];
}
10 changes: 10 additions & 0 deletions src/components/IngredientsCheck/models/Tooltip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export type IconClassType =
| "vegan icon-ok"
| "non-vegan icon-cancel"
| "unknown-vegan icon-help"
| "maybe-vegan icon-attention-alt";

export interface TooltipMessages {
"maybe-vegan": string;
"unkown-vegan": string;
}
4 changes: 4 additions & 0 deletions src/components/IngredientsCheck/models/TranslateFunction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type TranslationFunction = (
key: string,
values?: Record<string, string>
) => string;
32 changes: 32 additions & 0 deletions src/components/IngredientsCheck/shared/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use client";

import { useState } from "react";

interface TooltipProps {
message: string;
children: React.ReactNode;
}

export function TooltipClient({ message, children }: TooltipProps) {
const [isVisible, setIsVisible] = useState(false);

if (!message) {
return children;
}

return (
<div
className="tooltip-wrapper"
onMouseEnter={() => setIsVisible(true)}
onMouseLeave={() => setIsVisible(false)}
>
{children}
{isVisible && (
<div className="tooltip">
{message}
<div className="tooltip-arrow"></div>
</div>
)}
</div>
);
}
Loading
Loading