Skip to content

Commit

Permalink
Merge branch 'main' of github.com:codeEmpress1/snapcraft.io
Browse files Browse the repository at this point in the history
  • Loading branch information
codeEmpress1 committed Dec 12, 2023
2 parents dde333b + 615acb6 commit b0f03b9
Show file tree
Hide file tree
Showing 47 changed files with 2,774 additions and 2,036 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ module.exports = {
semi: ["error", "always"],
"object-curly-spacing": ["error", "always"],
},
settings: {
react: {
version: "detect"
}
}
};
36 changes: 36 additions & 0 deletions .github/.jira_sync_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
settings:
# Jira project key to create the issue in
jira_project_key: "WD"

# Dictionary mapping GitHub issue status to Jira issue status
status_mapping:
opened: Untriaged
closed: done

# (Optional) Jira project components that should be attached to the created issue
# Component names are case-sensitive
components:
- Stores Squad

# (Optional) GitHub labels. Only issues with one of those labels will be synchronized.
# If not specified, all issues will be synchronized
labels:
- "Bug 🐛"
- "Feature 🎁"

# (Optional) (Default: false) Add a new comment in GitHub with a link to Jira created issue
add_gh_comment: true

# (Optional) (Default: true) Synchronize issue description from GitHub to Jira
sync_description: true

# (Optional) (Default: true) Synchronize comments from GitHub to Jira
sync_comments: true

# (Optional) (Default: None) Parent Epic key to link the issue to
epic_key: "WD-7353"

# (Optional) Dictionary mapping GitHub issue labels to Jira issue types.
# If label on the issue is not in specified list, this issue will be created as a Bug
label_mapping:
enhancement: Story
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16

Expand Down
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RUN --mount=type=cache,target=/root/.cache/pip pip3 install --user --requirement
# ===
FROM node:16 AS yarn-dependencies
WORKDIR /srv
ADD package.json yarn.lock .
ADD package.json .
ADD yarn.lock .
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --production


Expand All @@ -26,8 +27,13 @@ RUN yarn run build-css
# Build stage: Run "yarn run build-js"
# ===
FROM yarn-dependencies AS build-js
WORKDIR /srv
ADD . .
ADD static/js static/js
ADD webpack.config.js .
ADD webpack.config.entry.js .
ADD webpack.config.rules.js .
ADD tsconfig.json .
ADD babel.config.json .
RUN yarn install
RUN yarn run build-js

# Build the production image
Expand Down
44 changes: 28 additions & 16 deletions humans.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
/* TEAM */
Web developer: Bartek Szopka
Location: Poznań, Poland

Web developer: João Figueiredo Martins
Location: London, UK

UX designer: Jordan Hughes
Location: London, UK

UX designer: Juan Real
Location: London, UK

Web developer: Luke Wesley-Holley
Engineering manager: Luke Wesley-Holley
Location: Leeds, UK

Web developer: Robin Winslow
Location: Derby, UK
UX designer: Anne-Sophie Muller Eliet
Location: Argancy, France

Web developer: Thomas Bille
Web developer: Alimot Akinbode
Location: Thuwal, Saudi Arabia

Web developer: Seulkee Kang
Location: London, UK

Web developer: Steve Rydz
Location: Nottingham, UK

/* THANKS */
Name: Alan Pope
Location: Farnborough, UK
Expand Down Expand Up @@ -60,6 +54,24 @@
Name: Will Moggridge
Location: London, UK

Name: Bartek Szopka
Location: Poznań, Poland

Name: João Figueiredo Martins
Location: London, UK

Name: Jordan Hughes
Location: London, UK

Name: Juan Real
Location: London, UK

Name: Robin Winslow
Location: Derby, UK

Name: Thomas Bille
Location: London, UK

/* SITE */
Language: English
Standards: HTML5 CSS3
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.21.0",
"@canonical/cookie-policy": "3.5.0",
"@canonical/global-nav": "3.6.1",
"@canonical/latest-news": "1.4.1",
"@canonical/react-components": "0.47.0",
"@canonical/global-nav": "3.6.2",
"@canonical/latest-news": "1.5.0",
"@canonical/react-components": "0.47.1",
"@canonical/store-components": "0.44.0",
"@dnd-kit/core": "6.0.8",
"@dnd-kit/sortable": "7.0.2",
"@dnd-kit/utilities": "3.2.1",
Expand Down Expand Up @@ -94,7 +95,7 @@
"topojson-client": "3.1.0",
"ts-loader": "9.4.2",
"typescript": "4.9.5",
"vanilla-framework": "4.4.0",
"vanilla-framework": "4.5.1",
"watch-cli": "0.2.3",
"webpack": "5.76.0",
"webpack-cli": "5.0.1",
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# App dependencies
canonicalwebteam.flask-base==1.1.0
canonicalwebteam.candid==0.9.0
canonicalwebteam.discourse==5.4.2
canonicalwebteam.blog==6.4.0
canonicalwebteam.discourse==5.4.7
canonicalwebteam.blog==6.4.1
canonicalwebteam.search==1.3.0
canonicalwebteam.image-template==1.3.1
canonicalwebteam.store-api==4.6.0
canonicalwebteam.store-api==4.7.1
canonicalwebteam.launchpad==0.8.4
canonicalwebteam.store-base==0.2.2
canonicalwebteam.store-base==0.3.4
django-openid-auth==0.16
Flask-OpenID==1.3.0
Flask-WTF==1.1.1
Expand Down
18 changes: 11 additions & 7 deletions static/js/base/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
var navAccountContainer = document.querySelector(".js-nav-account");

if (navAccountContainer) {
var notAuthenticatedMenu = navAccountContainer.querySelector(
".js-nav-account--notauthenticated"
);
var authenticatedMenu = navAccountContainer.querySelector(
".js-nav-account--authenticated"
);

fetch("/account.json")
.then((response) => response.json())
.then((data) => {
var notAuthenticatedMenu = navAccountContainer.querySelector(
".js-nav-account--notauthenticated"
);
var authenticatedMenu = navAccountContainer.querySelector(
".js-nav-account--authenticated"
);

if (data.publisher) {
var displayName = navAccountContainer.querySelector(
".js-account--name"
Expand All @@ -30,5 +30,9 @@ if (navAccountContainer) {
notAuthenticatedMenu.classList.remove("u-hide");
authenticatedMenu.classList.add("u-hide");
}
})
.catch(() => {
notAuthenticatedMenu.classList.remove("u-hide");
authenticatedMenu.classList.add("u-hide");
});
}
2 changes: 1 addition & 1 deletion static/js/brand-store/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Settings() {
settingsData.set("manual-review-policy", manualReviewPolicy);

fetch(`/admin/store/${id}/settings`, {
method: "POST",
method: "PUT",
body: settingsData,
})
.then((response) => {
Expand Down
65 changes: 42 additions & 23 deletions static/js/publisher/listing/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function App() {

const [isSaving, setIsSaving] = useState(false);
const [hasSaved, setHasSaved] = useState(false);
const [savedError, setSavedError] = useState(false);
const [savedError, setSavedError] = useState<boolean | {code: string, message: string}[] >(false);
const [showMetadataWarningModal, setShowMetadataWarningModal] = useState(
false
);
Expand Down Expand Up @@ -73,36 +73,47 @@ function App() {
}
};

const submitForm = (data: any) => {
const submitForm = async (data: any) => {
const changes = getChanges(dirtyFields, data);
const formData = getFormData(data, snapId, changes);

const previousDirtyFields = Object.assign({}, dirtyFields);

setHasSaved(false);
setIsSaving(true);
setSavedError(false);

fetch(`/${data.snap_name}/listing`, {
const response = await fetch(`/${data.snap_name}/listing.json`, {
method: "POST",
body: formData,
}).then((response) => {
if (shouldShowUpdateMetadataWarning(previousDirtyFields)) {
setUpdateMetadataOnRelease(false);
}

if (response.status === 200) {
setTimeout(() => {
setIsSaving(false);
setHasSaved(true);
reset(data);
window.scrollTo(0, 0);
}, 1000);
} else {
setTimeout(() => {
setIsSaving(false);
setSavedError(true);
}, 1000);
}
});

if (shouldShowUpdateMetadataWarning(previousDirtyFields)) {
setUpdateMetadataOnRelease(false);
}

if (response.status !== 200) {
setTimeout(() => {
setIsSaving(false);
setSavedError(true);
}, 1000);
return;
}

const jsonData = await response.json();
if (jsonData.error_list) {
setTimeout(() => {
setIsSaving(false);
setSavedError(jsonData.error_list);
}, 1000);
return;
}
setTimeout(() => {
setIsSaving(false);
setHasSaved(true);
reset(data);
window.scrollTo(0, 0);
}, 1000);
};

useEffect(() => {
Expand All @@ -125,6 +136,11 @@ function App() {
});
}, [listingData]);

window.localStorage.setItem(
`${listingData.snap_name}-initial`,
JSON.stringify(listingData)
);

return (
<>
<PageHeader snapName={listingData?.snap_name} activeTab="listing" />
Expand Down Expand Up @@ -188,12 +204,15 @@ function App() {
<div className="u-fixed-width">
<Notification
severity="negative"
title="Something went wrong."
title="Error"
onDismiss={() => {
setHasSaved(false);
setSavedError(false);
}}
/>
>
Changes have not been saved.<br />
{savedError === true ? "Something went wrong." : savedError.map((error) => `${error.message}`).join("\n")}
</Notification>
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";

import ListingFormInput from "../../components/ListingFormInput";
import MultipleInputs from "../../components/MultipleInputs";

type Props = {
Expand All @@ -10,14 +9,7 @@ type Props = {
control: {};
};

function ContactInformationSection({
getFieldState,
register,
publisherName,
control,
}: Props) {
const queryParams = new URLSearchParams(window.location.search);

function ContactInformationSection({ register, control }: Props) {
return (
<>
<div className="u-fixed-width">
Expand Down
5 changes: 3 additions & 2 deletions static/js/publisher/listing/utils/getListingData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ function getListingData(listingData: { [key: string]: any }) {
})
: [],
"source-code":
listingData.links && listingData.links["source-code"]
? listingData.links["source-code"].map((link: string) => {
listingData.links && listingData.links["source"]
? listingData.links["source"].map((link: string) => {
return {
url: link,
};
Expand Down Expand Up @@ -124,6 +124,7 @@ function getListingData(listingData: { [key: string]: any }) {
],
images,
snap_categories: window?.listingData?.snap_categories?.categories,
links: window?.listingData?.links,
};
}

Expand Down
4 changes: 2 additions & 2 deletions static/js/publisher/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function screenshotsAndVideos(screenshots, video) {
const holder = document.createElement("div");
holder.className = "p-snap-details__media row u-equal-height";
const col10 = document.createElement("div");
col10.className = "col-10 u-align-text--center";
col10.className = "col-10 u-align--center";
holder.appendChild(col10);
const videoSlide = document.createElement("div");
videoSlide.className = "js-video-slide u-embedded-media";
Expand Down Expand Up @@ -305,7 +305,7 @@ function render(packageName) {
functionMap.screenshots(
screenshotsEl,
screenshotsAndVideos(
transformedState.screenshots,
transformedState.screenshot_urls,
transformedState.video_urls
)
);
Expand Down
Loading

0 comments on commit b0f03b9

Please sign in to comment.